I need to retrieve results from a mysql database into the HTML drop down select box. I have done so with the following code and it works fine:
<select name="semamount">
<? do { ?>
<option value="<?php echo $row_sql['semprice'];?>"><?php echo $row_sql['semname'];?></option>
<?
} while ($row_sql = mysql_fetch_assoc($sql));
$rows = mysql_num_rows($sql);
if($rows > 0) {
mysql_data_seek($sql, 0);
$row_sql = mysql_fetch_assoc($sql);
}
?>
</select>
My problem is that as you can see from the code, the value is grabbed from a row named "semprice" and the display name is grabbed from a row named "semname". I would pass such variables to another php page that would capture the semprice and do a calculation but I dont know how to capture the select "semname". How would I also capture this part (semname) depending on which the user selected before being directed to the processing form.
If someone can help me, I would really appreate it, I have been struggling with this problem for a while now and I just can't figure out how to capture the "semname".
Thanks!