Guestbook help

Started by Tyler January 1st, 2006 8:06 PM
  • 2984 views
  • 2 replies
Age 31
Male
Minnesota
Seen March 31st, 2015
Posted April 26th, 2012
619 posts
17.5 Years
Im in need of some help with my coding.
http://www.p-k-h.net/guestbook/guestbook-sign.php
its says theres an error on line 23, but i dont know what to change.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://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.