I'm using a simple form to submit a row to my database. I don't get an error connecting to the database and it does inserts the row but it writes all values blank.
This is the form:
<form action="insert.php" method="post">
Título: <input type="text" name="title" />
Privacidad: <select type="text" name="privacy" />
<option value="public">Publico</option>
<option value="private">Privado</option>
</select><br/>
<input type="submit" />
</form>
And this is the insert.php file:
<?
$con = mysql_connect("removed","removed","removed");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("copoetry", $con);
$sql="INSERT INTO Poems (Title, Privacy)
VALUES
('$_POST[title]','$_POST[privacy]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($con)
?>
What am I doing wrong? Thanks
echo $sqlbefore doing the query to see the problem.