Jump to content


Photo

Help rqd on piece of code dynamic menu


  • Please log in to reply
1 reply to this topic

#1 terrymechan

terrymechan
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 29 April 2004 - 08:10 PM

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


#2 morpheus.100

morpheus.100
  • Members
  • PipPipPip
  • Advanced Member
  • 145 posts

Posted 30 April 2004 - 01:30 PM

Add a static entry to the dynamic menu and and use the selected tag to make it initially selected




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users