[56K WARN] Problem in PHP Guestbook
Posted: Wed Mar 28, 2007 12:02 pm
I created the guestbook's table in my database
all things looks perfectly ok, but i don't know where's the problem
this script is not completed
but its enough to insert the values in the table
i don't have any idea where i maked mistake
i wasted my 2 hour just for searching the its problem
can u find the it
Image 1

Image 2

Image 3

Image 4

Image 5

all things looks perfectly ok, but i don't know where's the problem
this script is not completed
but its enough to insert the values in the table
i don't have any idea where i maked mistake
i wasted my 2 hour just for searching the its problem
can u find the it
Code: Select all
<?php
require($_SERVER["DOCUMENT_ROOT"]."/config/db_config.php");
$connection = @mysql_connect($db_host, $db_user, $db_password) or die("error connecting");
mysql_select_db($db_name, $connection);
$name = $_POST["txt_name"];
$len = strlen($name);
//only write to database if there's a name
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());
}
?>
<html>
<head>
<title>Gestbook</title>
</head>
<body>
<center>
<form action="<?php echo $_SERVER[PHP_SELF]; ?>" method="POST">
<font face="arial" size="1">
Name: <input type="text" name="txt_name">;
Email: <input type="text" name="txt_email"><br><br>
Comment: <br>
<textarea style="width: 75%" rows="10" name="txt_comment"></textarea>
<center><input type="submit" value="Submit"></center>
</font>
</form>
</center>
</body>
</html>
Image 2

Image 3

Image 4

Image 5
