I've been trying to insert data in to the database and for some odd reason i'm not getting any parssing errors but its not inserting it in to the database. It just says thank you information entered. But when i go back to the database its not there. Can anyone of you see anything wrong with the code? Here it is:
<head>
<title> Update The News </title>
</head>
<body>
<?php
if ($submit) {
// process form
$db = mysql_connect("localhost", "<username>", "<password>");
mysql_select_db("<databasename>",$db);
$sql = "INSERT INTO news (name,topic,news,email, date) VALUES ( '$name', '$topic', 'news' , '$email', '$date=now()')"; $result = mysql_query($sql);
echo "Thank you! Information entered.\n";
}
else{
// display form
?>
<form method= "post" action= "<?php PHP_SELF?>">
Name: <input type="Text" name="name"> <br>
Topic: <input type="Text" name="topic"> <br>
News: <textarea rows="16" name="news" cols="57"></textarea><br>
E-mail: <input type ="text" name= "email"> <br>
<input type="hidden" name="date">
<P><input type="Submit" name="submit" value="Enter information"></p>
</form>
<?php
} // end if
?>
</body>
The '$date = now()' is supposed to insert the current date into the date field. Atleast its supposed to.
Thank you guys