I am new to PHP so bear with me. I have some code like this –
echo ('<select name="fullname">');
while($row = mysql_fetch_array($dorequest)) {
echo ('<option name="' . $row['ID'] . '">' . $row['firstname'] . " " . $row['lastname'] . '</option>');
}
echo('</select>');
Which works fine. When I submit the form I want to get the ID of the selected option ( $row[‘ID’] ). I can only get the content of the select box. Any ideas how I might do this?
Use a
valueattribute instead ofname:As the name for the sending variable is already set in your select
<select name="fullname">what you need to specify in the<option>is thevalueyou want to send.