I don't get why this isn't working, one of the most basic things and it's just not working for me. Here's the code, there's a problem with the insert statement.
<html>
<head>
<title></title>
</head>
<body>
<form name="blog_entry" method="post" action="<? $PHP_SELF ?>">
Title: <input type="text" name="subject"> <br>
Message: <textarea name="message" rows="10" cols="15"></textarea> <br>
<input type="submit" name="submit" value="Submit">
</form>
<?php
$dbcnx = mysql_connect("localhost", "dbuser", "dbpasswd") or die(mysql_error());
mysql_select_db("dbname", $dbcnx) or die(mysql_error());
if($_POST['submit'] == "Submit")
{
$insert = mysql_query("INSERT INTO entries (entry_id, entry_subject, entry, entry_date) VALUES ('', '$subject', '$message', NOW()") or die(mysql_error());
}
// The '' bit is because that's an ID field that's set on auto-increment.
?>
</body>
</html>
Thanks. 🙂
Edit: Here's the error that I get when I try to submit something:
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1