L Posted June 22, 2007 Share Posted June 22, 2007 alright...i can't seem to find what's wrong with my code. here it is, <?PHP include("db.php"); ?> <form id='1' name='1' method='post'> <table width="90%" border="0" cellspacing="0" cellpadding="0"> <tr> <td><div align="right">Username: </div></td> <td><input name="username" type="text" size="30" value=""></td> </tr> <tr> <td><div align="right">Contact: </div></td> <td><input type="text" name="contact" size="30" value=""> <i>(Email Address)</i></td> </tr> <td><div align="right">Subject: </div></td> <td><input type="text" name="subject" size="30" value=""></td> </tr> <tr> <td><div align="right">Comment: </div></td> <td><textarea name="comment" cols="45" rows="5" wrap="VIRTUAL"></textarea></td> </tr> <tr> <td></td> <td colspan="2"> <input type="submit" name="submit" value="Add Comment"></td> </tr> </table> </form> <?PHP $user = addslashes(strip_tags($_POST['username'])); $contact = addslashes(strip_tags($_POST['contact'])); $subject = addslashes(strip_tags($_POST['subject'])); $comment = addslashes(strip_tags($_POST['comment'])); $date = date("F j, Y."); $check = @mysql_num_rows(mysql_query("SELECT * FROM `comments` WHERE `comment`='".$comment."' ")); if ($_POST['submit']) { if ($check >= 1) { // Check to see if comment already exists echo "Comment has already been posted!"; } elseif ($contact == NULL || $subject == NULL || $comment == NULL || $user == NULL) { echo "Please fill in all fields."; } else { mysql_query("INSERT INTO `comments` (`user`, `contact`,`subject`,`comment`,`date`) VALUES ('".$user."','".$contact."','".$subject."','".$comment."','".$date."')"); echo "Comment has been posted! <META HTTP-EQUIV=\"REFRESH\" CONTENT=\"2; URL=/commentform.php\">"; } } ?> <table width="35%" cellspacing="2" cellpadding="2" border="2"> <tr> <td> User </td><td> Comment </td> </tr> <?PHP $newsid = $_GET['newsid']; $find = mysql_query("SELECT * FROM `comments` WHERE `newsid`='".$newsid."' ORDER BY `id` DESC LIMIT 0,50"); ($view = mysql_fetch_array($find)) $fetch = mysql_query("SELECT * FROM `comments` ORDER BY `id` DESC LIMIT 0,50"); // Display last 50 comments $ip = $_SERVER['REMOTE_ADDR']; $okip = "My IP"; while ($view = mysql_fetch_array($fetch)) { if ($ip == $okip) { echo "<tr><td><a href=\"mailto:".stripslashes($view['contact'])."\">".stripslashes($view['user'])."</a><br>".$view['date']."<br><center><a href=\"commentform.php?del=".$view['id']."\">[X]</a></center></td><td><textarea name=\"textarea\" cols=\"25\" rows=\"4\" wrap=\"virtual\" readonly>".stripslashes($view['comment'])."</textarea></td></tr>"; } else { echo "<tr><td><a href=\"mailto:".stripslashes($view['contact'])."\">".stripslashes($view['user'])."</a><br>".$view['date']."</td><td><textarea name=\"textarea\" cols=\"25\" rows=\"4\" wrap=\"virtual\" readonly>".stripslashes($view['comment'])."</textarea></td></tr>"; } } ?> </table> <?PHP $comment = $_GET['del']; if ($comment != NULL && is_numeric($comment)) { if ($ip == $okip) { mysql_query("DELETE FROM `comments` WHERE `id` = '".$comment."' LIMIT 1 "); echo "Comment has been deleted.<META HTTP-EQUIV=\"REFRESH\" CONTENT=\"2; URL=commentform.php\"> "; } else { echo "You do not have permission to delete comments."; } } ?> i uploaded it to http://taizkul.prohosts.org/commentform.php -Thank you for your time ~L Link to comment https://forums.phpfreaks.com/topic/56634-help-with-posting-comments/ Share on other sites More sharing options...
teng84 Posted June 22, 2007 Share Posted June 22, 2007 that is too long and whats the prob with that ????? ASTIG!!! Link to comment https://forums.phpfreaks.com/topic/56634-help-with-posting-comments/#findComment-279673 Share on other sites More sharing options...
L Posted June 22, 2007 Author Share Posted June 22, 2007 what do you mean by its too long...i just put it in instead of quote....also im not sure what you mean.... Link to comment https://forums.phpfreaks.com/topic/56634-help-with-posting-comments/#findComment-279674 Share on other sites More sharing options...
teng84 Posted June 22, 2007 Share Posted June 22, 2007 specify what do you want to do with that code and if theres an error show the error message and also the part of the code that causing the errors ASTIG!!! Link to comment https://forums.phpfreaks.com/topic/56634-help-with-posting-comments/#findComment-279676 Share on other sites More sharing options...
L Posted June 22, 2007 Author Share Posted June 22, 2007 ooohhh....haha...well i want there to be four fields where you can input info like a name, contact, subject, and the message. Then the page reloads to show your post and the date next to it. The problem im having is that when i upload it to, http://taizkul.prohosts.org/commentform.php, the screen turns blank. I'm not sure what i did wrong because it all looks fine to me. Then i have code where an X shows so i can delete spam comments...but it only shows with my ip address... and then when this problem is fixed...i was wondering if you could help me with having comments posted for specific news articles Link to comment https://forums.phpfreaks.com/topic/56634-help-with-posting-comments/#findComment-279678 Share on other sites More sharing options...
teng84 Posted June 22, 2007 Share Posted June 22, 2007 ooohhh....haha...well i want there to be four fields where you can input info like a name, contact, subject, and the message. Then the page reloads to show your post and the date next to it. The problem im having is that when i upload it to, http://taizkul.prohosts.org/commentform.php, the screen turns blank. I'm not sure what i did wrong because it all looks fine to me. Then i have code where an X shows so i can delete spam comments...but it only shows with my ip address... and then when this problem is fixed...i was wondering if you could help me with having comments posted for specific news articles ASTIG!!! ILL take a look Link to comment https://forums.phpfreaks.com/topic/56634-help-with-posting-comments/#findComment-279680 Share on other sites More sharing options...
teng84 Posted June 22, 2007 Share Posted June 22, 2007 its really empty maybe to debug it remove the <?PHP include("db.php"); ?> first and look if theres any cahnges if still no action happened i should say you are uploading the wrong file be sure that the file u upload is on right track ya know!!!! ASTIG!! Link to comment https://forums.phpfreaks.com/topic/56634-help-with-posting-comments/#findComment-279682 Share on other sites More sharing options...
L Posted June 22, 2007 Author Share Posted June 22, 2007 hmm...i reuploaded the file, and i took out to include and it still shows a blank page. Then i pasted the include back in and made sure i was uploading the right file because i checked before uploading.....does anyone know the solution to my problem because apparently the code is correct. Also the weriod thing is that this was working like two days ago...but now it isn't, Link to comment https://forums.phpfreaks.com/topic/56634-help-with-posting-comments/#findComment-280333 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.