This is a very simple Feedback form, and When I tested the code, I came up with this error:
Parse error: parse error, expecting T_STRING' orT_VARIABLE' or `T_NUM_STRING' in /hsphere/local/home/trinity/trinitypa.com/handleform.php on line 21
I am new to coding in PHP, I know HTML pretty well, but this baffles me.
Here is the Handling script:
<head>
<title>HANDLEFORM</title>
<body>
</head>
<?php
/ This page recieves and handles the data inputted from the feedback form/
// Trim the incoming data for processing by database
$Array["firstname"] = trim($Array["firstname"]);
$Array["lastname"] = trim ($Array["lastname"]);
$Array["email"] = trim ($Array["email"]);
$Array["comments"] = trim ($Array["comments"]);
//set the variables for the database access:
$Host = "XXXXX";
$User = "XXXXX";
$Password = "XXXXX";
$DBname = "tonytest";
$Tablename = "feedback";
//connect to database
$Link = mysql_connect ($Host, $User, $Password);
//Insert into Database:
$Query = "INSERT into $Tablename values ('0', '$Array["firstname"]', '$Array["lastname"]', '$Array["email"]','$Array["comments"]')";
print ("The Query is:<br>$Query<p>\n");
if (mysql_db_query ($DBname, $Query, $Link)){
print ("The Query Was Sucessful!!!!<br>\n");
} else{
print ("The Query Could Not be Executed.<br>\n");
}
mysql_close ($Link);
?>
</body>