CodeIgniter Forums
selected=selected - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: selected=selected (/showthread.php?tid=38382)



selected=selected - El Forum - 02-07-2011

[eluser]Bigil Michael[/eluser]
is it possible to do selected = selected in case of multiple select box???

can anyone help me? thanks in advance


selected=selected - El Forum - 02-07-2011

[eluser]ludovic[/eluser]
Read the guide http://ellislab.com/codeigniter/user-guide/helpers/form_helper.html and search form_dropdown()


selected=selected - El Forum - 02-08-2011

[eluser]Bigil Michael[/eluser]
i have already done adding multiple locations using multiple select box
now i want to do edit

values inside the table is like this
Code:
id destinations
1   tvm,kollam,ernakulam

Code:
i have read those values using this code

$loc = $this->Mypackages_model->select_destinations($selected_package);
$k = $loc->destinations;
//now $k = tvm,kollam, ernakulam

$k= explode(",",$k);
$data['locat'] = $k;


view
Code:
<select name="location[]" multiple="multiple" id="location">
                                &lt;?php
                                foreach($locat as $row)
                                {
                                ?&gt;
                                <option value="&lt;?php echo $row['location_name']?&gt;" &lt;?php echo set_select('location',$row['location_name']);?&gt; >&lt;?php echo $row['location_name']?&gt;</option>
                                &lt;?php
                                }
                                ?&gt;
                                 </select>


it only prints the first letters ie t,k,e
can any one help me thanks in advance


selected=selected - El Forum - 02-08-2011

[eluser]Bigil Michael[/eluser]
can anyone help me