Problem in PHP Guestbook

Discussion in 'PHP' started by libra, Mar 28, 2007.

  1. #1
    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

    <?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>
    PHP:

    Image
    [​IMG]


    Image
    [​IMG]


    Image
    [​IMG]


    Image
    [​IMG]
     
    libra, Mar 28, 2007 IP
  2. papa_face

    papa_face Notable Member

    Messages:
    2,237
    Likes Received:
    67
    Best Answers:
    1
    Trophy Points:
    285
    #2
    I helped you on PHPFreaks, but rather than ask double the amount of people to help you, i suggest you just post your problem on one forum.
     
    papa_face, Mar 28, 2007 IP
  3. libra

    libra Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    i just want to solve my quickly

    thants why done that

    ill mind this next time
     
    libra, Mar 28, 2007 IP