CodeIgniter Forums
condition based action should be changed? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: condition based action should be changed? (/showthread.php?tid=71622)



condition based action should be changed? - kvanaraj - 09-06-2018

I am using table row details with action column  . In this action once process completed show "completed button" otherwise show  edit icon. 

need suggestion.


RE: condition based action should be changed? - Wouter60 - 09-06-2018

Simply use if … else …, or the ? : operator.
PHP Code:
<?php 
$actionbutton 
$row['status'] == 'finished' anchor('link1','Completed','class="btn"') : anchor('link2','Edit','class="btn"');
?>

<td><?= $actionbutton;?></td>