robert_gsfame Posted August 11, 2009 Share Posted August 11, 2009 anyway i still confuse with combobox value :'( Can anyone tell me how to put the value into combobox so that it won't automatically change to first index of the combobox?? Help me explain this Link to comment https://forums.phpfreaks.com/topic/169756-repost-still-confuse-with-combobox-value/ Share on other sites More sharing options...
PFMaBiSmAd Posted August 11, 2009 Share Posted August 11, 2009 Output selected="selected" inside the <option > tag for the entry you want selected - http://w3schools.com/tags/att_option_selected.asp Link to comment https://forums.phpfreaks.com/topic/169756-repost-still-confuse-with-combobox-value/#findComment-895798 Share on other sites More sharing options...
robert_gsfame Posted August 14, 2009 Author Share Posted August 14, 2009 what i mean is that i have the value already, let say i've taken it from the database WHERE USERNAME='BLABLA' $take = mysql_fetch_array xxxxxxxxxxxxxxxxxxxxxxx $data = $take['country'] then how to put the value of $data into the combobox??? Link to comment https://forums.phpfreaks.com/topic/169756-repost-still-confuse-with-combobox-value/#findComment-897919 Share on other sites More sharing options...
play_ Posted August 14, 2009 Share Posted August 14, 2009 echo "<select>"; while( $row = mysql_fetch_array($result) ) { echo "<option value=".$row['country'].">" . $row['country'] . "</option>"; } echo "</select>"; Link to comment https://forums.phpfreaks.com/topic/169756-repost-still-confuse-with-combobox-value/#findComment-897925 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.