kenwvs
08-03-2006, 06:16 AM
This is a pretty basic form but for some reason the results won't send to the database. I know the DB connection is good because the technician drop down box gets the data from the DB. That is the one field that won't send data out either. I have added the print() to check it and all fields are being sent except the technician field.(only one obtaining data from DB) Any ideas why the technician field won't work and why it won't send data to the DB
<?php
include_once "myconnect.php";
?>
<?php
/* WorkOrder.php */
if (!isset($_POST['submit'])){
?>
<head>
<link href="ge.css" rel="stylesheet" type="text/css">
<title>GE Work Order</title>
</head>
<form action="" method="post">
<div>Work Order #:<input type="text" size="12" maxlength="12" name="order">
<?php
$result = mysql_query("SELECT * FROM employees") or die(mysql_error());
echo "Technician Name:<select name='tech'>";
while($row=mysql_fetch_array($result))
{
echo"<option value=\"{$row[Employee_ID]}\">{$row[First_Name]} {$row[Last_Name]}</option>";
}
echo"</select>";
?></select>
Site:<select name="Site">
<option value="No Selection Made">Select Site</option>
<option value="Burdett">Burdett</option>
<option value="Coaldale">Coaldale</option>
<option value="Fort McLeod">Fort McLeod</option>
<option value="Taber">Taber</option>
</select>
</div> <BR>
<div> Unit Serial #:<input type="text" size="10" maxlength="10" name="Serial">
Unit Hours:<input type="text" size="6" maxlength="6" name="Hours">
Unit Starts:<input type="text" size="6" maxlength="6" name="Starts">
Severity:<select name="Severe">
<option value="No Selection Made">Please Select Level</option>
<option value="Low Level">Low Level</option>
<option value="A.S.A.P.">A.S.A.P.</option>
<option value="Immediate Attention">Immediate Attention</option>
<option value="Severe">Severe</option>
</select>
Safety:<select name="Safe">
<option value="No Selection Made">Please Select Level</option>
<option value="Low Risk of Injury">Low Risk of Injury</option>
<option value="Medium Risk of Injury">Medium Risk of Injury</option>
<option value="High Risk of Injury">High Risk of Injury</option>
<option value="Injury has Occurred">Injury has Occurred</option>
</select>
</div> <BR>
<div>Description of Issue:<BR><textarea rows="4" name="Issue" cols="116"></textarea>
</div><BR>
<div>Possible Resolution<BR><textarea rows="4" name="Resolve" cols="116"> </textarea>
</div><BR>
<div>List of Parts Required (known at this time):</div>
<div><input type="text" size="155" maxlength="155" name="PartsA"><BR>
<input type="text" size="155" maxlength="155" name="PartsB"><BR>
<input type="text" size="155" maxlength="155" name="PartsC"><BR>
<input type="text" size="155" maxlength="155" name="PartsD"><BR>
<input type="text" size="155" maxlength="155" name="PartsE"><BR>
<input type="text" size="155" maxlength="155" name="PartsF"><BR>
<input type="text" size="155" maxlength="155" name="PartsG"><BR>
</div><BR>
<div>Request for Assistance:<BR><textarea rows="4" name="Assist" cols="116"></textarea>
</div><BR><BR>
<p align="center"><input type="submit" name="Submit" value="Submit Work Order"> <BR>
<p align="center"><input type="reset" name="Submit" value="Clear Form">
</form>
<?php
print_r($_POST);
?>
<?php
} else {
$Technician = $_POST[‘Tech’];
$Site = $_POST[‘Site’];
$Serial = $_POST[‘Serial’];
$Hours = $_POST[‘Hours’];
$Starts = $_POST[‘Starts’];
$Issue = $_POST[‘Issue’];
$Resolution = $_POST[‘Resolve’];
$Assistance = $_POST[‘Assist’];
$PartsA = $_POST[‘PartsA’];
$PartsB = $_POST[‘PartsB’];
$PartsC = $_POST[‘PartsC’];
$PartsD = $_POST[‘PartsD’];
$PartsE = $_POST[‘PartsE’];
$PartsF = $_POST[‘PartsF’];
$PartsG = $_POST[‘PartsG’];
$Safety = $_POST[‘Safe’];
$Severity = $_POST[‘Severe’];
mysql_query("INSERT INTO 'work order'(Technician, Site, Serial, Hours, Starts, Issue, Severity, Resolution, Assistance,
PartsA, PartsB, PartsC, PartsD, PartsE, PartsF, PartsG, Safety,) VALUES ('$Technician', '$Site', '$Serial',
'$Hours', '$Starts', '$Issue', '$Severity', '$Resolution', '$Assistance','$PartsA', '$PartsB', '$PartsC', '$PartsD',
'$PartsE', '$PartsF', '$PartsG', '$Safety')");
echo "Your Work Order Has Been Successfully Submitted!";
}
?>
</body>
</html>
<?php
include_once "myconnect.php";
?>
<?php
/* WorkOrder.php */
if (!isset($_POST['submit'])){
?>
<head>
<link href="ge.css" rel="stylesheet" type="text/css">
<title>GE Work Order</title>
</head>
<form action="" method="post">
<div>Work Order #:<input type="text" size="12" maxlength="12" name="order">
<?php
$result = mysql_query("SELECT * FROM employees") or die(mysql_error());
echo "Technician Name:<select name='tech'>";
while($row=mysql_fetch_array($result))
{
echo"<option value=\"{$row[Employee_ID]}\">{$row[First_Name]} {$row[Last_Name]}</option>";
}
echo"</select>";
?></select>
Site:<select name="Site">
<option value="No Selection Made">Select Site</option>
<option value="Burdett">Burdett</option>
<option value="Coaldale">Coaldale</option>
<option value="Fort McLeod">Fort McLeod</option>
<option value="Taber">Taber</option>
</select>
</div> <BR>
<div> Unit Serial #:<input type="text" size="10" maxlength="10" name="Serial">
Unit Hours:<input type="text" size="6" maxlength="6" name="Hours">
Unit Starts:<input type="text" size="6" maxlength="6" name="Starts">
Severity:<select name="Severe">
<option value="No Selection Made">Please Select Level</option>
<option value="Low Level">Low Level</option>
<option value="A.S.A.P.">A.S.A.P.</option>
<option value="Immediate Attention">Immediate Attention</option>
<option value="Severe">Severe</option>
</select>
Safety:<select name="Safe">
<option value="No Selection Made">Please Select Level</option>
<option value="Low Risk of Injury">Low Risk of Injury</option>
<option value="Medium Risk of Injury">Medium Risk of Injury</option>
<option value="High Risk of Injury">High Risk of Injury</option>
<option value="Injury has Occurred">Injury has Occurred</option>
</select>
</div> <BR>
<div>Description of Issue:<BR><textarea rows="4" name="Issue" cols="116"></textarea>
</div><BR>
<div>Possible Resolution<BR><textarea rows="4" name="Resolve" cols="116"> </textarea>
</div><BR>
<div>List of Parts Required (known at this time):</div>
<div><input type="text" size="155" maxlength="155" name="PartsA"><BR>
<input type="text" size="155" maxlength="155" name="PartsB"><BR>
<input type="text" size="155" maxlength="155" name="PartsC"><BR>
<input type="text" size="155" maxlength="155" name="PartsD"><BR>
<input type="text" size="155" maxlength="155" name="PartsE"><BR>
<input type="text" size="155" maxlength="155" name="PartsF"><BR>
<input type="text" size="155" maxlength="155" name="PartsG"><BR>
</div><BR>
<div>Request for Assistance:<BR><textarea rows="4" name="Assist" cols="116"></textarea>
</div><BR><BR>
<p align="center"><input type="submit" name="Submit" value="Submit Work Order"> <BR>
<p align="center"><input type="reset" name="Submit" value="Clear Form">
</form>
<?php
print_r($_POST);
?>
<?php
} else {
$Technician = $_POST[‘Tech’];
$Site = $_POST[‘Site’];
$Serial = $_POST[‘Serial’];
$Hours = $_POST[‘Hours’];
$Starts = $_POST[‘Starts’];
$Issue = $_POST[‘Issue’];
$Resolution = $_POST[‘Resolve’];
$Assistance = $_POST[‘Assist’];
$PartsA = $_POST[‘PartsA’];
$PartsB = $_POST[‘PartsB’];
$PartsC = $_POST[‘PartsC’];
$PartsD = $_POST[‘PartsD’];
$PartsE = $_POST[‘PartsE’];
$PartsF = $_POST[‘PartsF’];
$PartsG = $_POST[‘PartsG’];
$Safety = $_POST[‘Safe’];
$Severity = $_POST[‘Severe’];
mysql_query("INSERT INTO 'work order'(Technician, Site, Serial, Hours, Starts, Issue, Severity, Resolution, Assistance,
PartsA, PartsB, PartsC, PartsD, PartsE, PartsF, PartsG, Safety,) VALUES ('$Technician', '$Site', '$Serial',
'$Hours', '$Starts', '$Issue', '$Severity', '$Resolution', '$Assistance','$PartsA', '$PartsB', '$PartsC', '$PartsD',
'$PartsE', '$PartsF', '$PartsG', '$Safety')");
echo "Your Work Order Has Been Successfully Submitted!";
}
?>
</body>
</html>