Dynamic "value" in HTML form with PHP
Posted: Fri Mar 06, 2009 2:20 pm
I am creating a page where you can select an existing user from a drop down box and then edit that users information(username, password, email etc...). I currently have the drop down box that prints the users first and last name in as "options" in the menu. I am running into issues assigning a "value" to each option that actually represents the "option" that was chosen. Am i going about this wrong? help please.
<?php
while ($rows = mysql_fetch_array($result)) //extracts the results of the mysql query
{
extract($rows);
?>
<option value="VARIABLE TO CORRELATE TO THE RECORD PRINTED "><?php echo "$lastname, $firstname"; ?></option>
<?php
}//closes while loop
?>
</select>
<html>
<head>
</head>
<body>
<form action="edituser.php" method="post">
<input type="submit" name="edit" value="Edit User">
</form>
</body>
</html>
<?php