Form Dropdown From Database Display Error |
[eluser]jvk22[/eluser]
I'm using the form helper to populate a drop down, however when I put the database generated array in form_dropdown() it does not display correctly. This is what the drop down looks like and the values are id and name 0 1 USA 1 2 U.K. The actual id should be the value and the actual name should display Current Source: <select name="country"> <optgroup label="0"> <option value="id">2</option> <option value="name">test</option> </optgroup> <optgroup label="1"> <option value="id">1</option> <option value="name">United States</option> </optgroup> </select> What I'm trying to achieve <select name="country> <option name="1>USA</option> <option name="2">U.K.</option> </select>
[eluser]toopay[/eluser]
Use foreach statement. And when you post code, please use code tags Code: // Remove any spaces
[eluser]danmontgomery[/eluser]
Code: $dropdown = array(); http://ellislab.com/codeigniter/user-gui...sults.html |
Welcome Guest, Not a member yet? Register Sign In |