unexpected T_STRING - MySQL Input

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

Hey everyone,
I'm new to PHP, and to MySQL. I want this script to allow me to input a
value from a form (name) into a MySQL table (test table in test
database). Here's the form:
<form action="sql.php" method="POST">
Name:<input type="text" name="name" maxlength="10">
<br /> <input type="submit" name="submit" value="Submit Data">
And here's sql.php:
// Make a MySQL Connection
mysql_connect("localhost", "*****", "*****") or die(mysql_error());
mysql_select_db("test") or die(mysql_error());


// Insert a row of information into the table "films"
mysql_query("INSERT INTO test
(name) VALUES('$name') ");
or die(mysql_error());

echo "Data Inserted!";
Any help would be greately appreciated!

Re: unexpected T_STRING - MySQL Input

Also, I get this error message when I try to submit the form:
Parse error: parse error, unexpected T_STRING in
/home/cinema-t/public_html/gfsbeta/test/sql.php on line 9

Re: unexpected T_STRING - MySQL Input

Start at line 9 and work your way backwards looking for a missing
semi-colon, bracket, or paren.  More then likely you forgot one.

<snip  from above>$name=$_POST['name'] </snip from above>
 like in this line

Site Timeline