hotblooded wrote:Scratch that, I found it...it actually says exactly what you typed. What is the 'dept' inside the _POST brackets referring to?
It's the name of the element in the Form. In other words, if you have a Form that a user fills in, part of which looks like this in the html:
Code: Select all
<form method='POST' action='[i]script that will handle this form[/i]'>
Enter your Name here: <input type='text' [color=#008040] name='employee' [/color]/><br />
Enter your Dept. here: <input type='text' [color=#008040] name='dept' [/color]/><br />
<input type='submit' value='Submit Form'> </form>
then in the script that handles the submitted form (could be the same script or a different one), you would recover the values the user entered like this:
Code: Select all
$empl = $_POST['employee'];
$dept = $_POST['dept'];
In your case, instead of a simple <input type='text'...> element, it's a
select element (a dropdown selection) that is created dynamically in php. So I suspect there may be a problem there. Your code is written with a
do loop, which I almost never use, so I would rewrite the section that now looks like this:
Code: Select all
<select name="dept" id="dept">
<?php
do {
?>
<option value="<?php echo $row_dept['Fac_Dept']?>"<?php if (!(strcmp($row_dept['Fac_Dept'], $row_facstaff_edit['Fac_Dept']))) {echo "selected=\"selected\"";} ?>><?php echo $row_dept['Fac_Dept']?></option>
<?php
} while ($row_dept = mysql_fetch_assoc($dept));
$rows = mysql_num_rows($dept);
if($rows > 0) {
mysql_data_seek($dept, 0);
$row_dept = mysql_fetch_assoc($dept);
}
?>
to look like this:
Code: Select all
<?php
echo "<select name='dept' id='dept'> ";
while ($row_dept = mysql_fetch_assoc($dept)); {
$d = $row_dept['Fac_Dept'];
echo "<option value='$d'";
if (!(strcmp($d, $row_facstaff_edit['Fac_Dept']))) {
echo " selected";
}
echo ">$d</option>";
}
echo "</select>";
?>
I'm not sure that will solve your original problem, but I found it difficult to read the code that you now have, so I rewrote it as I would have done.