Multiple values in a form option field
| From: | Jeff McKeon | Date: | Thu, 13 Nov 2003 20:05:16 +0000 |
| Subject: | Multiple values in a form option field | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-169553@lists.php.net to get a copy of this message | ||
I have a php page that has a web form on it.
I do a query to populate the options in a drop down box in the form.
[code]
<select size="1" name="customer">
<?PHP
while($query_data1=mysql_fetch_row($result1)){
echo"<option
value='$query_data1[0]'>$query_data1[1]</option>";
}
?>
[code]
$query_data1[0] is a userID number
$query_data1[1] is the user's Email address
So when the user selects an email addres from the drop down box, the
userID is stored and later writen to a database.
What I now need to do is store not only the userID but the email address
as well. Is there a way using a form to store 2 values using one drop
down box? So basically I want to store the userID and the Email address
to a variable in the form so that both may be written to different
fields in the database later.
Jeff