Jump to content

shrimp

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Posts posted by shrimp

  1. oredi fixed and try it out bro.. still no clue y this still no data insert.
    if u dun mind, below i zip my file n screenshot of phpmyadmin mysql table..

    http://geocities.com/butter_punk/guestbook.zip
    Database name : test
    Table              : guestbook
    username        : root
    no password.

    Many thanks for the help n time bro..
  2. oredi try bro but still. the msg is.. NO DATA INSERTED hehehe

    this is my ugly form
    [quote]

    <html>
    <link href="style.css" rel="stylesheet" type="text/css" />
    <body>


    <p>
    <form method="POST" action="addguestbook1.php">
      <table width="500" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td width="145" class="halo">Name</td>
          <td width="355" class="halo"> :
            <input name="name" type="text" id="name">
          </td>
        </tr>
        <tr>
          <td class="halo">Email</td>
          <td class="halo"> :
            <input name="email" type="text" id="email">
          </td>
        </tr>
        <tr>
          <td class="halo">Comments</td>
          <td class="halo"> :
              <textarea name="comment" cols="40" id="comment"></textarea>
          </td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td class="halo">
            <label>
            <input type="submit" name="Submit" value="submit" >
            </label>
          </td>
        </tr>
      </table>
    </form>
    </p>
    </body>
    </html>



    [/quote]

    sorry trouble u bro
  3. hi redarrow thanks for helping me

    btw i did change the handler to this
    [quote]

    <html>
    <link href="style.css" rel="stylesheet" type="text/css" />
    <body>


    <p>

    <?php

    $db=mysql_connect("localhost","root","")or die("GAK BISA KONEK");
    mysql_select_db("guest",$db);

    $name=addslashes($_POST['name']);
    $email=addslashes($_POST['email']);
    $comment=addslashes($_POST['comment']);
    $datetime=addslashes($_POST['datetime']);

    $datetime=date("y-m-d h:i:s"); //date time

    if($_POST['submit']){

    $sql="INSERT INTO guestbook(`name`, `mail`, `comment`, `datetime`)VALUES('$name', '$email', '$comment', '$datetime');";
    $result=mysql_query($sql);
    }
    //check if query successful
    if($result){
    echo "Successful";
    echo "<BR>";
    echo "<a href='viewguestbook.php'>View guestbook[/url]"; // link to view guestbook page
    }

    else {
    echo "ERROR";
    }

    mysql_close();
    ?>
    </p>
    </body>
    </html>

    [/quote]

    but its error. when i press submit
    btw i dunno what u mean uppercase post. i did put post method. thanks a lot for the explanation mate.
    God Bless
  4. anyone can help ? anyway this is what i type on,

    this is the form
    [quote]

    <html>
    <link href="style.css" rel="stylesheet" type="text/css" />
    <body>


    <table width="400" border="0" align="center" cellpadding="3" cellspacing="0">
    <tr>
    <td class="halo"><strong>Test Sign Guestbook </strong></td>
    </tr>
    </table>
    <table width="400" border="0" align="center" cellpadding="3" cellspacing="0">
    <tr>
    <td class="halo"><strong><a href="viewguestbook.php">View Guestbook</a> </strong></td>
    </tr>
    </table>
    <form id="form2" name="form2" method="post" action="addguestbook.php">
      <table width="500" border="0" align="center" cellpadding="0" cellspacing="0" class="halo">
        <tr>
          <td width="147" class="halo">Name</td>
          <td width="353" class="halo"> :
              <label>
              <input name="name" type="text" id="name" />
              </label>
          </td>
        </tr>
        <tr>
          <td class="halo">Email</td>
          <td class="halo"> :
            <input name="email" type="text" id="email" />
          </td>
        </tr>
        <tr>
          <td class="halo">Comments</td>
          <td class="halo"> :
              <label>
              <textarea name="comment" cols="40" id="comment"></textarea>
              </label>
          </td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td class="halo">
            <label>
            <input type="submit" name="Submit" value="Submit" />
            </label>
          </td>
        </tr>
      </table>
    </form>
    <p>&nbsp;</p>
    </body>
    </html>


    [/quote]


    this is the handler :
    [quote]

    <html>
    <link href="style.css" rel="stylesheet" type="text/css" />
    <body>


    <p>
      <?php
    $host="localhost"; // Host name
    $username="root"; // Mysql username
    $password=""; // Mysql password
    $db_name="guest"; // Database name
    $tbl_name="guestbook"; // Table name

    echo "$name";

    // Connect to server and select database.
    mysql_connect("$host", "$username", "$password")or die("cannot connect server ");
    mysql_select_db("$db_name")or die("cannot select DB");

    $datetime=date("y-m-d h:i:s"); //date time

    $sql="INSERT INTO $tbl_name(name, email, comment, datetime)VALUES('$name', '$email', '$comment', '$datetime');";
    $result=mysql_query($sql);

    //check if query successful
    if($result){
    echo "Successful";
    echo "<BR>";
    echo "<a href='viewguestbook.php'>View guestbook</a>"; // link to view guestbook page
    }

    else {
    echo "ERROR";
    }

    mysql_close();
    ?>
    </p>
    </body>
    </html>

    [/quote]

    anyone can help me with the error  :(
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.