Hi, I wrote a script to add info to an Access database via a form. When the page is loaded, I get the following error message:
Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement., SQL state 37000 in SQLExecDirect in c:\program files\apache group\apache\htdocs\nc\test1.php on line 23
Help!! Here is my code:
<head>
<title>Test page</title>
</head>
<body>
<form action="test1.php" method="POST">
Name: <input type="text" name="Name"><br>
Age: <input type="text" maxlength="2" name="Age"><br>
Location: <input type="text" name="Location"><br>
Email: <input type="text" name="Email"><br>
<input type="Submit" value="Add" name="Submit">
</form>
<?
$Connect = odbc_connect("News", "NC", "TEST");
$Query = "INSERT INTO Test (Name, Age, Location, Email) VALUES ('$Name', $Age, '$Location', '$Email')";
if(!(odbc_exec($Connect, $Query)))
{
print('Info could not be added to database');
}
?>
</body>
What is wrong with it? Any help appreciated, thanks.