I am in the process of studying PHP and wondering if someone would be kind enough to help me with a bit I am stuck with.
In the following form it will pull a list of the users Addresses based on the users ID and show them by their 'Address_Name' field.
However, when they select say 'Home Address' I don't want to pull that value which is the 'Address_Name' but I want to pull the row value for 'Address_ID'.
Can anyone help me understand how I can do this, bearing in mind the 'Address_Name' will not be UNIQUE.
<?php
$add=mysql_query("SELECT * FROM Address_Book WHERE User_ID = '$id'");
while ($row = mysql_fetch_array($add)){
?>
<form name="form1" onsubmit="return validate()">
<input type="hidden" name="command" />
<div align="center">
<h1 align="center">Confirm Order</h1>
<table border="0" cellpadding="2px">
<tr><td>Order Total:</td><td><?php echo $currency ?><?php echo get_order_total()?></td></tr>
<tr><td>Account_Number</td><td><input type="text" name="accountnumber" /></td></tr>
<tr><td>Delivery Address</td><td><select name="owner">
<option name="address" id="address" value="Address_Name"><?php echo $row['Address_Name']; ?></option>
</td></tr>
<tr></tr>
<tr><td> </td><td><input type="submit" value="Confirm Order" /></td>
</tr>
</table>
</div>
</form>
<?php
}
?>