Problem:
Better way to fill select box in phpSolution:
Use Heredoc as below exampleExample:
Assuming that $rs_list is the query result.<?php
$list_trans="";
foreach ($rs_list->result() as $row_list) {
$nm= $row_list->nm;
$id=$row_list->id;
$list_trans.= <<<ABC
<option value="$id">$nm</option>
ABC;
}
?>
<select name="transporter_id">
<?php echo $list_trans;?>
</select>
0 comments:
Post a Comment