PC Posted April 7, 2009 Share Posted April 7, 2009 I have the following code for populating a combo box: echo "<td>City Search:</td>"; echo "<td><select Name=A_City>"; for($i=0;$i<=$nbcities;$i++) { echo "<option value=".$cityset[CITY_ID][$i].">".$cityset[CITY_NAME][$i]."</option>\n"; echo "</select>"; Unfortunately the first city is correct but the second and subsequent ones aren't in the list but on the screen to the right and therefore not selectable. Can anyone advise where I am goig wrong please? Thanks Paul Quote Link to comment https://forums.phpfreaks.com/topic/153026-solved-combo-box-problem/ Share on other sites More sharing options...
Fruct0se Posted April 7, 2009 Share Posted April 7, 2009 echo "<td>City Search:</td>"; echo '<td><select Name="A_City">'; for($i=0;$i<=$nbcities;$i++) { echo '<option value="'.$cityset[CITY_ID][$i].'">'.$cityset[CITY_NAME][$i]."</option>\n"; } echo "</select>"; Quote Link to comment https://forums.phpfreaks.com/topic/153026-solved-combo-box-problem/#findComment-803721 Share on other sites More sharing options...
PC Posted April 7, 2009 Author Share Posted April 7, 2009 Thanks for your quick response. Worked a treat except that it passes the position in the box rather than the city_id value. Any ideas? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/153026-solved-combo-box-problem/#findComment-803728 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.