This code is correctly inserting into the MySQL table.
The thing is i want to be able to leave the "name" empty in the form and (if that were the case) "Anonymous" should be inserted into the name filed.
<?php
$con = mysql_connect("localhost","root","root");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("jacket", $con);
$sql="INSERT INTO quote (frase, name)
VALUES
('$_POST[frase]','$_POST[name]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "Thanks? Insult submited";
mysql_close($con)
?>
I dont know wether the question is sufficiently clear, if not please ask me!!
Thanks in advance
Juan


Sign In
Create Account

Back to top









