I am trying to create my first database. I mainly used this tutorial to have my database up and connected, however, I am having some problems inserting the data from the form into the database. I know the db is connected as I can retrieve the data data back from the db to the php but not in other way round.
I tried searching, but it seems that the problem is too unique for me to generalize from the past issues already solved.
I have this error whenever I finish up the forum:
Parse error: syntax error, unexpected 'VALUES' (T_STRING) in D:\xampp\htdocs\softwarefirm\create.php on line 20
The code for the create file is:
<?php
include 'include/connection.php';
$name = $_POST['inputFirstName'];
$email = $_POST['inputEmail'];
$pnum = $_POST['inputPhoneNumber'];
$hdate = $_POST['HireDate'];
$jtitle = $_POST['JobTitle'];
$salary = $_POST['Salary'];
$manid = $_POST['ManagerID'];
$depid = $_POST['DepartmentID'];
if(!$_POST['submit']) {
echo "please fill out the form";
header('Location: index.php');
} else {
mysql_query("INSERT INTO employee (`EID`, `FirstName`, `Email`, `PhoneNumber`, `HireDate`, `JobTitle`, `Salary`, `ManagerID`, `DepartmentID`")
VALUES(NULL, '$name', '$email', '$pnum', '$hdate', '$jtitle', '$salary', '$manid','$depid')") or die(mysql_error());
echo "User has been added";
header ('Location: index.php');
}
?>