I am using Codeigniter. In the controller, I have a select tag something like
$action='<select name="pp_fileStatus[]" class="form-control multipleselect wip_fileStatus" data-id="'.$row->bank_id.'">
<option value="" disabled selected>File Status</option>
<option value="1">Disbursed </option>
<option value="2">Files sumitted </option>
<option value="3">Pendency </option>
<option value="4">Approved</option>
<option value="5">Rejected</option>
<option value="6">Dropped</option>
</select>';
Now what I am doing is, I have to use an if
condition to show the selected option. So I tried:
<option value="1"'if($row->status == "1"){ echo "selected"; }'>Disbursed </option>
but it is showing the wrong results.
Should I create something like this:
$action='<select name="pp_fileStatus[]" class="form-control multipleselect wip_fileStatus" data-id="'.$row->bank_id.'">
<option value="" disabled selected>File Status</option>
<option value="1"';
if($row->b_filestatus == "1"){ echo "selected"; }
$action='>Disbursed </option>
<!--more here-->
or should I use an altogether different method?