Hi guys,
Im just wondering of its possible to do this. I’ve created a query that displays the results as a drop down in a form. That bit seems to work OK but im having trouble figuring out how to POST that value into my processing script.
Here is the code for the form:
<?php
$sql = ("SELECT * FROM staff ORDER BY name ASC");
$query = mysql_query($sql) or die(mysql_error());
?>
<form name="attend" method="post" action="sick_process.php" >
<?php
echo "<select name='staff_name'>";
// printing the list box select command
while ($row = mysql_fetch_array($query)) {
echo "<option value=$row[staff_number]>$row[name]</option>";
/* Option values are added by looping through the array */
}
echo "</select>";// Closing of list box
?>
<br />
Site: <input type="text" name="location" > <br />
Hours: <input type="text" name="hours_worked" ><br />
<input type="hidden" name="sick" value="1" >
<input type="hidden" name="auth" value="1" >
<br />
<input type="submit" name="submit" value="Submit">
</form>
I want to be able to use the selected option in a query on the processing form, but cant figure out how to post this bit:
echo "<option value=$row[staff_number]>$row[name]</option>";
Ive tried using
$user_id = $_POST['staff_name'];
in sick_process.php but that doesnt work.
Any ideas how i can get around this?
Thanks in advance.