Hey I would like to add a simple contact box to my web site. I have followed on line tutorials but they never seem to work the way they are meant to: I have set up a table on phpMyadmin called comment with table called comment and 3 columns: id,name and comment. I have used this code for the comment box page...index.php
<html>
<form action="post_comment.php" method="POST">
<input type="text" name="name" value="Your Name"><br>
<textarea name="comment" cols="50" rows="2">Enter your query and contact details</textarea><br>
<input type="submit" value="Submit">
</form>
Then i have another page called post_comment.php with the mysql coding on it...
<?php
mysql_connect("localhost","root","");
mysql_select_db("comment");
$name = $_POST["name"];
$comment = $_POST["comment"];
$comment_length = strlen($comment);
if($comment_length > 100)
{
header("location: index.php?error=1")
}
else
{
mysql_query("INSERT INTO comment VALUES('','$name','$comment')")
header("location: index.php")
}
?>
BUT once i enter details in the input boxes instead of the details being sent to my table i get this error
Parse error: syntax error, unexpected end of file, expecting variable
(T_VARIABLE) or ${ (T_DOLLAR_OPEN_CURLY_BRACES) or {$ (T_CURLY_OPEN)
in C:\xampp\htdocs\tutorials\contact1.php on line 16
Line 16 of my code only has the else statement written on it. Could someone have a look as i know it's basic but I'm just starting out. Thanks in Advance.Paul