I am having a problem inserting information into my database. It will not create a record, no matter what I do. I have used the exact same template for two other pages, and it works fine, but for this one, it simply will not work. If I echo each variable, it will print out, but even if I reduce the insert to one field, it still will not work. Please help... Here is my code.
<?php
session_start();
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>WO</title>
</head>
<body>
<?php
require('connect.php');
$ID = $_POST['ID'];
$CustomerFirstName = $_POST['Customer_B'];
$CustomerLastName = $_POST['Customer_A'];
$CustomerAddress = $_POST['Customer_C'];
$CustomerCity = $_POST['Customer_D'];
$CustomerState = $_POST['Customer_E'];
$CustomerZipCode = $_POST['Customer_F'];
$CustomerPhone = $_POST['Customer_G'];
$CustomerEmail = $_POST['Customer_H'];
$SCLastName = $_POST['Service_A'];
$SCFirstName = $_POST['Service_B'];
$SCAddress = $_POST['Service_C'];
$SCCity = $_POST['Service_D'];
$SCState = $_POST['Service_E'];
$SCZip = $_POST['Service_F'];
$SCPhone = $_POST['Service_G'];
$SCEmail = $_POST['Service_H'];
$DateRequested = date('Y-m-d', strtotime($_POST['Date_Requested']));
$DateScheduled = date('Y-m-d', strtotime($_POST['Date_Scheduled']));
$AssignedTo = $_POST['Assigned_To'];
$ServiceBranch = $_POST['Service_Branch'];
$Warranty = isset($_POST['Warranty'])?$_POST['Warranty']:"No";
$WorkRequested = $_POST['Work_Requested'];
$sql = "INSERT INTO WorkOrder (ID, CustomerLastName, CustomerFirstName, CustomerAddress, CustomerCity, CustomerState, CustomerZip, CustomerPhone, CustomerEmail, SCLastName, SCFirstName, SCAddress, SCCity, SCState, SCZip, SCPhone, SCEmail, DateRequested, DateScheduled, Warranty, WorkRequested, ServiceBranch, AssignedTo)
VALUES ('$ID', '$CustomerLastName', '$CustomerFirstName', '$CustomerAddress', '$CustomerCity', '$CustomerState', '$CustomerZipCode', '$CustomerPhone', '$CustomerEmail', '$SCLastName', '$SCFirstName', '$SCAddress', '$SCCity', '$SCState', '$SCZip', '$SCPhone', '$SCEmail', '$DateRequested', '$DateScheduled', '$Warranty', '$WorkRequested', '$ServiceBranch', '$AssignedTo')";
if ($conn->query($sql) == TRUE) {
echo "<script type='text/javascript'> alert('Work Order Created'); </script>";
echo "<script type='text/javascript'> document.location = 'Main.php'; </script>";
} else {
echo "<script type='text/javascript'> alert('Record Not Inserted'); </script>";
echo "<script type='text/javascript'> document.location = 'Work_Order.php'; </script>;
}
?>
</body>
</html>