![]() |
Dropdown in a form - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Dropdown in a form (/showthread.php?tid=30068) |
Dropdown in a form - El Forum - 05-02-2010 [eluser]maniac[/eluser] I am trying to add a dropdown list in a form instead of using a text box for the information to be added, but it keeps coming up blank. Can anyone help me with what I am doing wrong? My code on the view page - <form action="http://localhost/aStage2CI/index.php/results/insertresult" method="POST"> <p class ="bold">Course ID:<br /> <select name="Select"> <?php foreach($result as $row):?> <option value="<?echo $row->courseid?>"> <?echo $row->courseid?></option> <?php endforeach;?> </select></p> ..........</form> The actual form worked well with just the text boxes. Thanks Dropdown in a form - El Forum - 05-02-2010 [eluser]Unknown[/eluser] hi, i'm a bit of a noob to CI, but i'm fairly sure you're missing a semi-colon ( ![]() hope that helps. Dropdown in a form - El Forum - 05-02-2010 [eluser]maniac[/eluser] Hi, I am very new to this too, but get lots of help here. I am missing the semicolon, but didn't help with the problem. Thanks Dropdown in a form - El Forum - 05-02-2010 [eluser]pickupman[/eluser] Try this: Code: $dropdown = array('FALSE' => 'Please Select'); //Create array Make sure that the variable $result is the result object and not a query object. (ie. Somewhere you have passed $result = $some_query->result(); Otherwise, it won't work. Please use the <code> button when posting code into the forums. It will make it easier for people to copy and pasted your code. |