• Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Guestbook help

Tyler

PHP Scripter
  • 620
    Posts
    19
    Years
    Im in need of some help with my coding.
    https://www.p-k-h.net/guestbook/guestbook-sign.php
    its says theres an error on line 23, but i dont know what to change.
    HTML:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="https://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>
    </head>
    
    <body>
    <?php
    $self = $_SERVER['PHP_SELF'];
    $name = $_POST['name'];
    $email = $_POST['email'];
    $comments = $_POST['comments'];
    $submit = $_POST['submit'];
    
    #the html form
    $form = "<form action=\"$self\" method=\"post\">";
    $form. = "Name: <input type=\"text\" name=\"name\" "; 
    $form. = "size=\"50\" value=\"$name\"> <br>";
    $form. = "Email: <input type=\"text\" name=\"email\" ";
    $form. = "size=\"50\" value=\"$email\"> <br>";
    $form. = "Comments:<br>;
    $form. = "<textarea name=\"comments\" cols=\"45\" ";  <--This is line 23
    $form. = "rows=\"4\">$comments</textarea> <br>";
    $form. = "<input type=\"submit\" name=\"submit\" ";
    $form. = "value=\"Sign\"> </form>";
    
    #on first opening display the form
    if( !$submit) { $msg = $form; }
    
    #or redisplay a message and the forum if incomplete
    else if( !$name or !$email or !$comments)
    { $msg = "<b>Please Complete all the fields</b><BR><BR>";
      $msg.= $form; }
      
      #or add the form data to the guestbook datatable
      else #otherwise connect to Mysql
      { $conn = @mysql_connect( "localhost", "atariguy_guestbo", "soccer" )
      or die( "Could not connect to database" );
      
      #select the database
      $rs = @mysql_select_db( "atariguy_guestbook", $conn )
      or die ( "Could not select database" );
      
      #create the SQL query
      if( $name and $comments )
      {
      $sql ="insert into guestbook (name, email, comments)
      values(\"$name\",\"$email\",\"$comments\"); }
      
      #confirm entry and display a link to view Guestbook
      if($rs)
      { $msg = "<h3>Thank You - Your entry has been saved.";
        $msg.=<br><a href = \"guestbook/guestbook-veiw.php\">";
        $msg.="Veiw My GuestBook</a></h3>"; }
        }
        
        #write the page
        echo( $msg );
        ?>
    </body>
    </html>
    so i you could help that would be awesome.
     
    Last edited:
    Just use the auto-install script from cPanel ><. It will save you some time.
     
    Back
    Top