Can anyone tell me why this code isnt showing me the form on my website click the link and youll see what i mean.?
http://www.webspace4rent.biz/guestbook/sign.php
below is the code.
PHP Code:<html><head><title>Sign the guestbook</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\" ";
$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 form 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 database table
else #otherwise connect to MySQL
{ $conn = @mysql_connect( "localhost", "webspace_guest", "brodie" )
or die( "Could not connect to database" );
#select the database
$rs = @mysql_select_db( "webspace_guest", $conn )
or die ( " Could not select database" );
#create the SQL query
if( $name and $comments )
{
$sql ="insert into guestbook (name email, comments)
value(\$name\",\"$email\",\"$comments\")";
$rs = @mysql_query( $sql $conn )
or die ("Could not execute SQL query");}
#confirm entry and display a link to view guestbook
if($rs)
{ $msg = "<h3>Thank you - your entry has been saved.";
$msg = "<br><a href = \"view.php\">";
$msg = "View My Guestbook</a></h3>"; }
}
#write the page
echo( $msg );
?>
</body></html>




Reply With Quote