php - I have trouble in set_select in codeignitor -
i have worked in codeignator framework , have problem in select tag. when want achieve value of option have selected. used method when select option value pressed search button , after need result showing , want again value of selected option second submit button , whole data selected option value must go data base. code follow.
<select id="faculty" data-rel="chosen" name='stdid'> <option>select student</option> <?php foreach ($student $s) { echo '<option set_select("student","'.$s['stdid'].'","true") value="'.$s['stdid'].'">'.$s['stdname'].' ' .$s['stdid'].'</option>'; }?> </select>
you confusing php html. change code this:
<select id="faculty" data-rel="chosen" name="stdid"> <option>select student</option> <?php foreach ($student $s) { echo '<option'.set_select("stdid", $s['stdid'], true).' value="'.$s['stdid'].'">'.$s['stdname'].' '.$s['stdid'].'</option>'; }?> </select>
note setting option
elements set_select("stdid", $s['stdid'], true)
become selected="selected"
. read more set_select.
Comments
Post a Comment