terrymechan
-
Posts
1 -
Joined
-
Last visited
Never
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.
Help rqd on piece of code dynamic menu
in Editor Help (PhpStorm, VS Code, etc)
Posted
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