Hi all,
This has me going around in circles so I’m hoping someone can shed some light on my problem.
I have a user profile page, on this page I have included a comments system via
require_once(‘comments.php’);
The problem I am having is that after entering and posting a comment the text field for entering the comment along with the submit button disappear. The actual comment does not show on the page.
Refreshing the page resubmits the comment so it now appears twice, but the actual form and the post button still do not show.
Any ideas? Here is the code for comments.php
[php]//query comments for this page of this article
$inf = “SELECT * FROM comments WHERE page = '”.stripslashes($_SERVER[‘REQUEST_URI’])."’ ORDER BY id DESC";
$info = mysql_query($inf);
if(!$info) die(mysql_error());
$info_rows = mysql_num_rows($info);
if($info_rows > 0) {
echo ‘’;
echo ‘
| '.stripslashes($info2->subject).'From: '.stripslashes($info2->username).' | '; echo ' |
| '.stripslashes($info2->comment).' | '; echo '
'; } else echo 'No notes for this page.
';
if(isset($_POST[‘submit’])) {
if(!addslashes($_POST[‘comment’])) die(‘ERROR: cannot add comment if you do not enter one!?’);
?>
'); } //end while //add comment $username=$qls->user_info["username"]; $contact=($_POST["userprofiles.php?username=' . $qls->user_info['username'] . '"]); $q ="INSERT INTO `comments` (article_id, page, date, time, username,contact,comment) VALUES ('".$_GET['id']."', '".$_POST['page']."', '".$_POST['date']."', '".$_POST['time']."', '$username', '$contact', '".addslashes(htmlspecialchars(nl2br($_POST['comment'])))."')"; $q2 = mysql_query($q); if(!$q2) die(mysql_error()); } else { //display form ?>
</div>