please help me.i unable to find the following error in code Parse error: parse error in c:\easyphp1-8\www\insert.php on line 13 my column names in mysql(db_user)(person) firstname lastname age <html> <body> <form name=frmname" method="post" action="insert.php" enctype="multipart/form-data"> <table border="0" wodth=200 height=200 align="center"> <tr><td>Firstname</td><td><input type="text" name="fname"></td></tr> <tr><td>Lastname</td><td><input type="text" name="lname"></td></tr> <tr><td>age</td><td><input type="text" name="age"></td></tr> <tr colspan="2"><td align="center"><input type="submit" value="submit"></td></tr> </table> </body> </html> insert.php <?php $con=mysql_connect("localhost","root",""); if(!$con) { die("connection error:".mysql_error()); } else { mysql_select_db("db_user",$con); $qry="INSERT INTO person(firstname,lastname,age)VALUES('$_POST[fname]','$_POST[lname]','$_POST[age]') if(!mysql_query($qry,$con)); { die("connection error:".mysql_error()); } echo "record is added"; mysql_close($con); } ?>
there is no need to have enctype as "multipart/form-data" one error at html, you forget double quote at name another might be u've forget space in $qry and semicolon( too. it should be Is it useful?
$qry="INSERT INTO person (firstname, lastname, age) VALUES ('$_POST[fname]','$_POST[lname]','$_POST[age]')"; PHP: You forgot to close the quote, phd.