darkfreaks Posted July 21, 2007 Share Posted July 21, 2007 my page appears blank can anyone point out any errors i may have overlooked? <?php include('connect.php'); $datetime=date("D M j G:i:s T Y"); //date time $name=$_POST[name]; $comment=$_POST[comment]; $email=$_POST[email]; if($_POST[comment]=="") {$error[comment]="Please enter a comment";} else {unset($error[comment]);} if($_POST[name]=="") {$error[name]="Please enter a name";} else {unset($error[name]);} if($_POST[email]=="") {$error[email]="Please enter an email";} else {unset($error[email]);} ?> <?php if ($error) { ?> <table width="400" border="0" align="center" cellpadding="3" cellspacing="0"> <tr> <td><strong>Test Sign Guestbook </strong></td> </tr> </table> <table width="400" border="0" align="center" cellpadding="0" cellspacing="1" > <tr> <form id="form1" name="form1" method="post" "> <td> <table width="400" border="0" cellpadding="3" cellspacing="1"> <tr> <td width="117">Name</td> <td width="14">:</td> <td width="357"><input name="name" type="text" id="name" size="40" /></td> </tr> <tr> <td>Email</td> <td>:</td> <td><input name="email" type="text" id="email" size="40" /></td> </tr> <tr> <td valign="top">Comment</td> <td valign="top">:</td> <td><textarea name="comment" cols="40" rows="3" id="comment"></textarea></td> </tr> <tr> <td> </td> <td> </td> <td><input type="submit" name="Submit" value="Submit" /> <input type="reset" name="Submit2" value="Reset" /></td> </tr> </table> </td> </form> </tr> </table> <table width="400" border="0" align="center" cellpadding="3" cellspacing="0"> <tr> <td><strong><a href="viewguestbook.php">View Guestbook</a> </strong></td> </tr> </table> <?php }else{ $sql="INSERT INTO guestbook(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 } mysql_close(); } ?> Quote Link to comment Share on other sites More sharing options...
redarrow Posted July 21, 2007 Share Posted July 21, 2007 $name=$_POST[name]; to all ['name']; see the missing ' ' Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted July 21, 2007 Author Share Posted July 21, 2007 doesnt make a difference with or without the '' it still doesnt work. Quote Link to comment Share on other sites More sharing options...
redarrow Posted July 21, 2007 Share Posted July 21, 2007 <?php if (! $error) { ?> Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted July 21, 2007 Author Share Posted July 21, 2007 its not the error statement tried removing it and it still wont wok Quote Link to comment Share on other sites More sharing options...
tanvir Posted July 21, 2007 Share Posted July 21, 2007 I have copied your code and pasted to a file named test.php. When I browse to that page I did show the form with bunch of errors. So I don't see why would you not see anything on the page. I think the possible problem is on connect.php. Some error on that page might have causing your page to show nothing.. Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted July 21, 2007 Author Share Posted July 21, 2007 connect.php is working fine on my other addons. i dunno what could be wrong with the code. Quote Link to comment Share on other sites More sharing options...
pedrobcabral Posted July 21, 2007 Share Posted July 21, 2007 logs? Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted July 21, 2007 Author Share Posted July 21, 2007 i dont see any errors on guestbook.php recoded in the error log. is there anyway to troubleshoot this? also it says "page can not be found" Quote Link to comment Share on other sites More sharing options...
redarrow Posted July 21, 2007 Share Posted July 21, 2007 my version <?php include("connect.php"); $datetime=date("D M j G:i:s T Y"); //date time $name=addslashes($_POST['name']); $comment=addslashes($_POST['comment']); $email=addslshes($_POST['email']); if( ($_POST['comment']=="") || ($_POST['name']=="") || ($_POST['email']=="") ){ echo "Please Fill In All The Form"; }else{ $sql="INSERT INTO guestbook(name, email, comment, datetime)VALUES('$name', '$email', '$comment', '$datetime')"; $result=mysql_query($sql)or die("mysql_error()"); if(mysql_affected_rows($result)){ echo "<center> Thank you Guessbook updated <br><br> </center>"; } } ?> <table width="400" border="0" align="center" cellpadding="3" cellspacing="0"> <tr> <td><strong>Test Sign Guestbook </strong></td> </tr> </table> <table width="400" border="0" align="center" cellpadding="0" cellspacing="1" > <tr> <form id="form1" name="form1" method="post" "> <td> <table width="400" border="0" cellpadding="3" cellspacing="1"> <tr> <td width="117">Name</td> <td width="14">:</td> <td width="357"><input name="name" type="text" id="name" size="40" /></td> </tr> <tr> <td>Email</td> <td>:</td> <td><input name="email" type="text" id="email" size="40" /></td> </tr> <tr> <td valign="top">Comment</td> <td valign="top">:</td> <td><textarea name="comment" cols="40" rows="3" id="comment"></textarea></td> </tr> <tr> <td> </td> <td> </td> <td><input type="submit" name="Submit" value="Submit" /> <input type="reset" name="Submit2" value="Reset" /></td> </tr> </table> </td> </form> </tr> </table> Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted July 21, 2007 Author Share Posted July 21, 2007 i get a 404 error page not found what could be causing this? Quote Link to comment Share on other sites More sharing options...
pedrobcabral Posted July 21, 2007 Share Posted July 21, 2007 Probably your browser's url its not pointing to your php file. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.