No data in database



Hi I was writing some code for a guestbook but somehow the data is not being entered in the database ie the guestbook table is empty. The code im using is below. Any ideas why it wont work? tnx

$connection = @mysql_connect($db_host, $db_user, $db_password) or die("error connecting");
mysql_select_db($db_name, $connection);

if ($len>0)
$email = $_post["txt_email"];
$comment = $_post["txt_comment"];
$date = time();

$query = "insert into guestbook(autoID, name, email, comment, date_auto) VALUES(NULL, '$NAME', '$EMAIL','$COMMENT','$DATE')";
MYSQL_QUERY($query, $connection) or die(mysql_error());

<form action="<?php echo $_SERVER[php_self]; ?>" method="get">
<font face="verdana" size="1">
Name: <input type="text" name="txt_name"> 
Email: <input type="text" name="txt_email"><br><br>
<textarea style="width: 75%" rows=10 name="txt_comments"></textarea>
<center><input type="Submit" value="Submit"></center></p>

try removing @ from this part:

$connection = @mysql_connect($db_host, $db_user, $db_password) or die("error connecting");

The problem is that @ suppresses error... and that way you are not able to see the "error connecting" if an error accures..

If that doesnt work -- we will have to take a bit deeper look..
I think part of the problem is case sensitivity... $_post is not the same as $_POST, and MYSQL_QUERY is not the same as mysql_query. (There are some others as well.)

Another problem I can see, is that you've specified that the data gets sent by the form as $_GET variables, but then tried to collect them with $_POST variables...