Hello,
I am new to php and mySQL so this is probably something very basic that I'm
missing. Basically, on the page I have 2 combo boxes but 1 of them is not
getting the value passed when the page is reloaded so the database can be
updated. I am echoing the field names passed and the field "theDriver" is
there but it's empty. I've include the code parts where I believe the
problem should be but I'm stumped and I've been trying to solve this for 2
days without success. Would someone mind examing the following code and
tell me what I've done wrong?
Thanks very much for any help received,
Vic
Following code constructs the combo box on the page from a MySQL table:
<?PHP
$table = "tblEmployees";
$Link = mysql_connect ($host, $user, $password);
$Query = "select concat(empID,'; ',empFirstName,'
',empLastName)
as full_name from $table WHERE empTitle =
'Driver'";
$results = mysql_db_query($database, $Query, $Link);
?>
<b>Driver:</b>
<select name = "theDriver" size="1">
<Option Value=" ">Select One:</option>
<?PHP
for($u=0;$u<mysql_num_rows($results); $u++)
{
$driver=mysql_result($results,$u,'full_name');
?>
<option value="<?PHP echo($ID); ?>"><?
echo($driver); ?></option>
<?PHP
}
?> //end php
</select>
When Page is reloaded the following code is run but the combo box titled
"theDriver" is empty
foreach($_POST as $field => $value)
{
echo $field; //field names from form
echo "; ";
if ($field == "theDriver")
{
echo " - here's the driver for ya: ";
$$field = strip_tags(trim($value));
echo $$field;
$pos = strpos($driver, ";");
echo "<br> the ; is in pos $pos <br>";
echo $value;
}
else
{
if ($field != "baseCharge" and $field !="extraCharge"
and $field !="comments" )
{
if ($value == "")
{
unset($_GET['id']);
$message_new = "Required information is missing.
Please try again.";
include("BagDelivery_form.inc");
exit();
}
}
$$field = strip_tags(trim($value));