Im building a feedback forum from scratch, i was doing fine until i started implementing a time-stamp feature to stamp the posts, i was using the current_date function in SQL but someone advised me to use the now() function instead, which im implementing, See the below code:
Form:
Action:
Display:
but as you can see, if you goto www.dmoranda.co.uk/form.php i get the message "Did not enter a name" when i did..
anyone else spot an obvious mistake?
Form:
Code:
<form action='action.php' method='post'>
Name: <input type='text' name='name' size='20'><br>
Comment:<br>
<textarea name='comment' rows='5' cols='40'></textarea><br>
<input type='submit' name='submit' value='submit'></form>
Action:
Code:
<?php
include "connect.php";
if(isset($_POST['submit']))
{
$date=$_POST['date'];
$name=$_POST['name'];
$comment=$_POST['comment'];
if(strlen($name)<1)
{
print "You did not enter a name.";
}
else if(strlen($comment)<1)
{
print "You did not enter a comment.";
}
else
{
$insert="Insert into visitordata (name,COMMENT,DATE) values('$name','$comment',now())";
mysql_query($insert) or die("Could not insert comment");
print "Comment added. <A href='display.php'>Click here</a> to see all comments.";
}
}
?>
Display:
Code:
<?php
include "connect.php";
$getdata="SELECT * from visitordata order by entryid desc";
$getdata2=mysql_query($getdata) or die("Could not get data");
while($getdata3=mysql_fetch_array($getdata2))
{
$getdata3[name]=strip_tags($getdata3[NAME]);
$getdata3[comment]=strip_tags($getdata3[COMMENT]);
print "-------------------------------------------------------------";
print "<br>";
print "Date/Time: $getdata3[DATE]";
print "Name: $getdata3[NAME]<br>";
print "$getdata3[COMMENT]<br>";
}
but as you can see, if you goto www.dmoranda.co.uk/form.php i get the message "Did not enter a name" when i did..
anyone else spot an obvious mistake?