Welcome Guest, Not a member yet? Register   Sign In
How to make the options selected in CI forms
#1

[eluser]dhaulagiri[/eluser]
Code:
<?php
echo form_dropdown('my_select_name', $yes_no, $_POST['yes_or_no'], 'id="my_select"');
?>

Dear friends, how do i add options selected as in above form ? Please help
Thanks
#2

[eluser]Maglok[/eluser]
I quote the user guide for a sec:

Quote:Lets you create a standard drop-down field. The first parameter will contain the name of the field, the second parameter will contain an associative array of options, and the third parameter will contain the value you wish to be selected. You can also pass an array of multiple items through the third parameter, and CodeIgniter will create a multiple select for you.

So put an array as 2nd parameter, the array being filled with options. There are some examples in the user guide: http://ellislab.com/codeigniter/user-gui...elper.html




Theme © iAndrew 2016 - Forum software by © MyBB