html - Using the ternary operator in php to echo different statuses based on an event status in sql -
well if status 1 it's "active insurance event" , if 2 it's "completed insurance event".
if(!empty($ins_event)) { echo "<tr><td> <img src='/check-icon.gif'> <a href='". matry::here(array('event_id'=>$ins_event['id'])) . "'>" . ( $ins_event['status'] == 2 ? "completed insurance event": "active insurance event") . "</a></td></tr>"; } else { echo "<tr><td>" . cbox_return() . "<a href='". matry::here_to('new', array('tfilt'=>'in', 'pfilt'=>$patient->code)) . "' style='color: #000; color:$rx_image_color'>**ins event not created**</td></tr>"; } i have variable color here:
<?php $rx_event_colors = $rx_ev_status = '#009933'; ?> how can utilize variable grab status of 2 , alter font color.
should break script , utilize if {} else {} statements?
updated code:
echo "<tr><td> <img src='/check-icon.gif'> <a href='". matry::here(array('event_id'=>$ins_event['id'])) . "'" . ( $ins_event['status'] == 2 ? ' style="color: ' . $rx_ev_status . '">completed insurance event' : '>active insurance event') . "</a></td></tr>";
you same kind of ternary operation:
($ins_event['status'] == 2 ? ' style="color: ' . $rx_ev_status . '"' : '') php html sql css
No comments:
Post a Comment