I want to connect PHP to access DB and insert values from my forms, but it is not working. The bottom code shows HTML form, I want to add Combobox to access DB as well.
ERROR MESSAGE :
Warning: odbc_exec(): SQL error: [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement., SQL state 37000 in SQLExecDirect in C:\xampp\htdocs\insert\save.php on line 14 Failed
The form inserted before now it is not working
<?php
if(isset($_POST['submit'])) {
$date = $_POST['date'];
$address = $_POST['address'];
$township = $_POST['township'];
$description = $_POST['description'];
echo $date." ".$address." ".$township." ".$description;
echo"<br>";
echo"<br>";
$con = odbc_connect("studentinfo","","");
$insert_data = "INSERT INTO Tie_In_Entry
(Date, Address, Township, Description)
VALUES ('$date','$address','$township','$description')";
if (odbc_exec($con, $insert_data)) {
echo "Database Connected & Inserted";
header("refresh:1;url=index.php");
}else{
echo "Failed";
}
}
?>
<input placeholder= "date" type="text" name="date" >
<br>
<input placeholder= "address" type="text" name="address" >
<br>
<input placeholder= "township" type="text" name="township" >
<br>
<input placeholder= "wo" type="text" name="wo" >
<br>
<input placeholder= "description" type="text" name="description" >
<br>
<input type="submit" name="submit" value = "Submit">