I am trying to write data into MySQL table but continue to get an 'HTTP error 500' page when I click submit. I don't think it has anything to do with the form but here is the code im using:
<form method="post" enctype="multipart/form-data" action="rma.php">
<p>
Start Date:<br />
<input type="date" name="datecomp"><br /><br />
<select name="action">
<option value="record">Record New Entry</option>
<option value="search">Search for Existing</option>
</select><br />
<br />
Status:<br />
<select name="status">
<option value="Complete">Complete</option>
<option value="Follow Up">Follow Up</option>
</select><br />
Last Name/Last 4:</br>
<input type="text" name="nameLast4" placeholder="last name, last 4 digits of social"></br>
Device/s:</br>
<input type="text" name="device" placeholder="(multiple separated by commas)"></br>
Device Serial Number/s:</br>
<input type="tel" name="serial" placeholder="..."></br>
New Serial Number:</br>
<input type="text" name="newser" placeholder="..."><br /><br />
Flagged:</br>
<input type="radio" name="flag" value="yes"> Yes <input type="radio" name="flag" value="no"> No </br><br />
Warranty Expired:</br>
<input type="radio" name="warranty" value="yes"> Yes <input type="radio" name="warranty" value="no"> No </br><br />
Date Returned to Vendor:</br>
<input type="date" name="returnDate"><br /><br />
UPS Tracking:<br />
<input type="tel" name="ups" placeholder="..."></br><br />
RMA Form Upload:
<input type="file" name="fileToUpload" id="fileToUpload"><br /><br />
RMA Number:<br />
<input type="text" name="RMA_#" placeholder="..."><br />
<br />
Date Completed:<br />
<input type="date" name="datecomp"><br /><br />
E.T.A. (If Available):<br />
<input type="date" name="eta"><br /><br />
Initials<br />
<input type="text" name="init"><br />
<textarea name="notes" cols="30" rows="5" placeholder="Optional Notes..."></textarea>
</br>
<input type="submit" name="submit" value="Submit"> <input type="reset" value="Clear Form"> 
</p>
</form>
And then the PHP....
<?php
$action = $_POST['action'];
$status = $_POST['status'];
$name = $_POST['nameLast4'];
$dev = $_POST['device'];
$serial = $_POST['serial'];
$rmanum = $_POST['RMA_#'];
$flag = $_POST['flag'];
$ups = $_POST['ups'];
$warr = $_POST['warranty'];
$returndate = $_POST['returnDate'];
$newser = $_POST['newser'];
$eta = $_POST['eta'];
$rmaform = $_POST['fileToUpload'];
$datestart = $_POST['startdate'];
$datecomp = $_POST['datecomp'];
$init = $_POST['init'];
$comments = $_POST['notes'];
$servername = "localhost";
$username = "kylezeio_admin";
$password = "********";
$dbname = "kylezeio_RMA";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
if ($action === "record"){
$sql = "INSERT INTO `kylezeio_RMA`.`RMA Records` (`ID`, `Complete/Follow up`, `Name/Last4`, `Device`, `Serial Number`, `RMA Number`, `Flagged`, `UPS Tracking`, `Warranty Expired`, `Date Returned`, `New Serial Number`, `E.T.A. (if available)`, `Date Completed`, `Date Started`, `Initials`, `Comments`) VALUES (NULL, $status, $name, $dev, $serial, $rmanum, $flag, $ups, $warr, $returndate, $newser, $eta, $datecomp, $datestart, $init, $comments);";
}
if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
?>
You can also view the page @ http://kylejoeckel.com/RMA%20Form.html
Thanks in advance...
EDIT:
I was missing a semicolon so i believe that that is why i got the 500 error, now i am getting this:
Error: INSERT INTO kylezeio_RMA.RMA Records (ID, Complete/Follow up, Name/Last4, Device, Serial Number, RMA Number, Flagged, UPS Tracking, Warranty Expired, Date Returned, New Serial Number, E.T.A. (if available), Date Completed, Date Started, Initials, Comments) VALUES (NULL, Complete, joeckel,9999, cmdr, 589437609287, l654651, yes, 1z8e983756987, no, 2016-11-21, 356928679, 2016-11-17, 2016-11-08, , hg, test);
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ' hg, test)' at line 1
but i dont know what syntax error it would be refering to.