Jump to content

Help rqd on piece of code dynamic menu


Recommended Posts

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

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.