terrymechan Posted April 29, 2004 Share Posted April 29, 2004 I have a code problem I havea list/menu box in a form, which will be updated on submission The list is a list of countries from a My Sql Table. I wish to pre-enter the record which already exists, which I can do from identifying the Unique record ID. However, I then want the drop down box reveal all the countries listed in that table For some reason, I can either populate the drop down list with this coding <select name="Ecom_ShipTo_Postal_CountryCode" > <?php while(!$countrylist->EOF){ ?> <option value="<?php echo $countrylist->Fields('COUNTRY')?>"><?php echo $countrylist->Fields('COUNTRY')?></option> <?php $countrylist->MoveNext(); } $countrylist->MoveFirst(); ?> or insert the existing choice of the user, by adding this code. <select name="Ecom_ShipTo_Postal_CountryCode" title="<?php echo $existingrecord->Fields('Country'); ?>" > <?php while(!$countrylist->EOF){ ?> <option value="<?php echo $countrylist->Fields('COUNTRY')?>"><?php echo $countrylist->Fields('COUNTRY')?></option> <?php $countrylist->MoveNext(); } $countrylist->MoveFirst(); ?> </select> What I need is code which will display the existing entry, AND allow the drop down list box to display the countries from the MYsql table Link to comment https://forums.phpfreaks.com/topic/1820-help-rqd-on-piece-of-code-dynamic-menu/ Share on other sites More sharing options...
morpheus.100 Posted April 30, 2004 Share Posted April 30, 2004 Add a static entry to the dynamic menu and and use the selected tag to make it initially selected Link to comment https://forums.phpfreaks.com/topic/1820-help-rqd-on-piece-of-code-dynamic-menu/#findComment-5964 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.