Jump to content

Recommended Posts

I have a comment/feedback section to my website.  After a person enters their comment and submits it I was hoping to have it refresh the page with the current page and their comments now displayed, but it is redirecting me to another page that I include.  The website is http://www.dancleary.com/feedback.php.  I am extremely new to php, so any help would be greatly appreciated.

Thanks!!

Link to comment
https://forums.phpfreaks.com/topic/65640-page-doesnt-refresh-to-current-one/
Share on other sites

Here is the whole page;s code . . .

 

 

 

<html>

 

<head>

 

<title>dancleary.com:: Feedback</title>

 

 

<!-- TALKBACK STYLESHEETS AND JAVASCRIPT -->

<script type='text/javascript' src='/talkback/includes/talkback.js'></script>

<link rel='stylesheet' type='text/css' href='/talkback/style.css' />

<link rel='stylesheet' type='text/css' href='/talkback/styleCustom.css' />

<!--[if IE]>

<link rel='stylesheet' type='text/css' href='/talkback/styleIE.css' />

<![endif]-->

<script type='text/javascript' src='/talkback/includes/jquery-c.js'></script>

<script type='text/javascript' src='/talkback/includes/thickbox.js'></script>

<link rel='stylesheet' type='text/css' href='/talkback/styleThickbox.css' />

<!-- END OF TALKBACK STYLES AND JAVASCRIPT -->

 

 

<meta http-equiv="Content-Language" content="en-us">

 

<title>dancleary.com :: The Official Home Of Dan Cleary</title>

 

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

 

<!-- Fireworks 4.0  Dreamweaver 4.0 target.  Created Fri Mar 02 02:02:11 GMT-0800 2040-->

 

<script language="JavaScript">

 

</script>

 

<meta name="description" content="Dan Cleary">

 

<meta name="keywords" content="Dan Cleary">

 

<link href="favicon.ico" rel="icon">

 

</head>

 

<body bgcolor="#CCCCCC" onLoad="MM_preloadImages('common/titlebar_photo_gallery_red.gif','common/titlebar_classics_red.gif','common/titlebar_humor_red.gif','common/titlebar_links_red.gif','common/titlebar_home_red.gif')">

 

<table border="0" cellpadding="0" cellspacing="0" width="740" align="center">

 

  <!-- fwtable fwsrc="header2.png" fwbase="header.gif" fwstyle="Dreamweaver" fwdocid = "742308039" fwnested="0" -->

 

  <tr>

 

    <td width="14"><img src="common/spacer.gif" width="14" height="1" border="0"></td>

 

    <td width="83"><img src="common/spacer.gif" width="83" height="1" border="0"></td>

 

    <td width="78"><img src="common/spacer.gif" width="78" height="1" border="0"></td>

 

    <td width="194"><img src="common/spacer.gif" width="194" height="1" border="0"></td>

 

    <td width="78"><img src="common/spacer.gif" width="78" height="1" border="0"></td>

 

    <td width="46"><img src="common/spacer.gif" width="46" height="1" border="0"></td>

 

    <td width="79"><img src="common/spacer.gif" width="79" height="1" border="0"></td>

 

    <td width="37"><img src="common/spacer.gif" width="37" height="1" border="0"></td>

 

    <td width="76"><img src="common/spacer.gif" width="76" height="1" border="0"></td>

 

    <td width="41"><img src="common/spacer.gif" width="41" height="1" border="0"></td>

 

    <td width="14"><img src="common/spacer.gif" width="14" height="1" border="0"></td>

 

    <td width="1"><img src="common/spacer.gif" width="1" height="1" border="0"></td>

 

  </tr>

 

  <tr>

 

    <td colspan="11">

 

<img name="dcc" src="common/dcc_banner.gif" width="740" height="62" border="0"></td>

 

    <td width="1"><img src="common/spacer.gif" width="1" height="62" border="0"></td>

 

  </tr>

 

  <tr>

 

    <td width="14" height="24"><img name="titlebar1" src="common/titlebar1.gif" width="14" height="24" border="0"></td>

 

    <td width="83" height="24">

 

<a href="gallery_copy(1).htm" onMouseOut="MM_swapImgRestore()"  onMouseOver="MM_swapImage('titlebar_photo_gallery_blue','','common/titlebar_photo_gallery_red.gif',1);" >

 

<img name="titlebar_photo_gallery_blue" src="common/titlebar_photo_gallery_blue.gif" width="83" height="24" border="0" alt="Photo Gallery"></a></td>

 

    <td width="78" height="24"><img name="titlebar2" src="common/titlebar2.gif" width="78" height="24" border="0"></td>

 

    <td width="194" height="24"><a href="classics.htm" onMouseOut="MM_swapImgRestore()"  onMouseOver="MM_swapImage('titlebar_classics_blue','','common/titlebar_classics_red.gif',1);" >

 

<img name="titlebar_classics_blue" src="common/titlebar_classics_blue.gif" width="194" height="24" border="0" alt="Cleary's Christmas Classics CD's"></a></td>

 

    <td width="78" height="24"><img name="titlebar3" src="common/titlebar3.gif" width="78" height="24" border="0"></td>

 

    <td width="46" height="24"><a href="humor.htm" onMouseOut="MM_swapImgRestore()"  onMouseOver="MM_swapImage('titlebar_humor_blue','','common/titlebar_humor_red.gif',1);" >

 

<img name="titlebar_humor_blue" src="common/titlebar_humor_blue.gif" width="46" height="24" border="0" alt="Humor"></a></td>

 

    <td width="79" height="24"><img name="titlebar4" src="common/titlebar4.gif" width="79" height="24" border="0"></td>

 

    <td width="37" height="24"><a href="links.htm" onMouseOut="MM_swapImgRestore()"  onMouseOver="MM_swapImage('titlebar_links_blue','','common/titlebar_links_red.gif',1);" >

 

<img name="titlebar_links_blue" src="common/titlebar_links_blue.gif" width="37" height="24" border="0" alt="Links"></a></td>

 

    <td width="76" height="24"><img name="titlebar5" src="common/titlebar5.gif" width="76" height="24" border="0"></td>

 

    <td width="41" height="24">

 

<a href="index.html" onMouseOut="MM_swapImgRestore()"  onMouseOver="MM_swapImage('titlebar_home_blue','','common/titlebar_home_red.gif',1);">

 

<img name="titlebar_home_blue" src="common/titlebar_home_blue.gif" width="41" height="24" border="0" alt="Home"></a></td>

 

    <td width="14" height="24"><img name="titlebar1" src="common/titlebar1.gif" width="14" height="24" border="0"></td>

 

  </tr>

 

</table>

 

</p>

 

 

<table border="0" cellpadding="0" cellspacing="0" width="700" align="center">

 

    <td>

<div id='tb-wrapper'>

<!-- Leave a comment link -->

<p id='tb-comment-link'><a href='#entry'>Leave a Comment</a></p>

<!-- Language select links -->

<p class='tb-center'></p>

 

<a id='list' name='list'></a>

<!-- Sort order line -->

<form id='tb-sort' action='/talkback/comments.php'  method='post'>

<input type='hidden' name='action' value='customize'  />

<input type='hidden' name='page' value='/talkback/comments.php' />

<input type='hidden' name='article_url' value='/talkback/comments.php' />

<input type='hidden' name='language' value='' />

<input type='hidden' name='form_author' value='' />

<input type='hidden' name='form_email' value ='' />

<input type='hidden' name='form_website' value='http://' />

<input type='hidden' name='form_location' value='' />

<input type='hidden' name='form_rememberme' value='0' />

<input type='hidden' name='article_title' value='' />

 

<!-- Input field for number of comments to be displayed -->

<label>Show:</label>

<input class='tb-num-rows' type='text' name='numrows' value='15' size='4' />

 

<!-- Sort order radio buttons -->

<label>  Sort:</label>

<input type='radio' name='sortorder' value='DESC' checked='checked'  /><label class='tb-radio'>Newest first</label>

<input type='radio' name='sortorder' value='ASC'  /><label class='tb-radio'>Oldest first  </label>

 

<!-- Apply button -->

<input class='tb-submit' type='submit' name ='customize' value ='Apply' />

</form><div class='tb-small tb-center'><noscript>Javacript is required for help and viewing images.</noscript></div>

 

<div class='tb-comment-legend'>There are 2 comments</div>

 

<!-- Comment header and comment text -->

<div id='ID-9' class='tb-comment' >

<div class='tb-reply-legend'> </div>

<div class='tb-comment-header'>

<div class='tb-author-loc'>

<span class='tb-author'>test</span>

<span class='tb-location'> – ddd</span>

</div>

<!-- <div class='tb-id'>  | #9</div>  -->

<div class='tb-date'>August 18, 2007 - 20:30</div>

</div>

<div class='tb-comment-subject'><span class='tb-subject-title'>Subject:</span> adadfa</div>

<div class='tb-comment-text'><p>asdfasdf</p>

</div>

</div>

 

<!-- Comment footer (reply, edit, spam and delete links) -->

<div class='tb-comment-footer'>

 

<form class='tb-replyto-link' action='/talkback/comments.php'  method='post'>

<input type='hidden' name='page' value='/talkback/comments.php' />

<input type='hidden' name='article_url' value='/talkback/comments.php' />

<input type='hidden' name='sortorder' value='DESC' />

<input type='hidden' name='rowstart' value='0' />

<input type='hidden' name='rowend' value='15' />

<input type='hidden' name='numrows' value='15'  />

<input type='hidden' name='language' value='' />

<input type='hidden' name='article_title' value='' />

<input type='hidden' name='reply' value='1' />

<input type='hidden' name='form_replyto' value='9' />

<input class='tb-reply-submit' type='submit' value='Reply' />

</form> 

</div>

 

<!-- Comment header and comment text -->

<div id='ID-4' class='tb-comment' >

<div class='tb-reply-legend'> </div>

<div class='tb-comment-header'>

<div class='tb-author-loc'>

<span class='tb-author'>Joe</span>

<span class='tb-location'> – Philadelphia</span>

</div>

<!-- <div class='tb-id'>  | #4</div>  -->

<div class='tb-date'>August 16, 2007 - 07:23</div>

</div>

<div class='tb-comment-subject'><span class='tb-subject-title'>Subject:</span> Great Site</div>

<div class='tb-comment-text'><p>Excellent Site Dan!!</p>

</div>

</div>

 

<!-- Comment footer (reply, edit, spam and delete links) -->

<div class='tb-comment-footer'>

 

<form class='tb-replyto-link' action='/talkback/comments.php'  method='post'>

<input type='hidden' name='page' value='/talkback/comments.php' />

<input type='hidden' name='article_url' value='/talkback/comments.php' />

<input type='hidden' name='sortorder' value='DESC' />

<input type='hidden' name='rowstart' value='0' />

<input type='hidden' name='rowend' value='15' />

<input type='hidden' name='numrows' value='15'  />

<input type='hidden' name='language' value='' />

<input type='hidden' name='article_title' value='' />

<input type='hidden' name='reply' value='1' />

<input type='hidden' name='form_replyto' value='4' />

<input class='tb-reply-submit' type='submit' value='Reply' />

</form> 

</div><a name='entry'></a>

 

<div class='tb-leave-comment-legend'>Leave a Comment</div>

<!-- The comment entry form -->

<div id='tb-form-div'>

<form id='tb_form' name='tb_form' action='/talkback/comments.php'  method='post' onsubmit='return validateForm(this.form)'>

<input type='hidden' name='action' value='add' />

<input type='hidden' name='form_replyto' value="" />

<input type='hidden' name='page' value='/talkback/comments.php' />

<input type='hidden' name='article_url' value='/talkback/comments.php' />

<input type='hidden' name='reply' value='' />

<input type='hidden' name='edit' value='' />

<input type='hidden' name='sortorder' value='DESC' />

<input type='hidden' name='rowstart' value='0' />

<input type='hidden' name='rowend' value='15' />

<input type='hidden' name='numrows' value='15'  />

<input type='hidden' name='language' value='' />

<input type='hidden' name='article_title' value='' />

 

<!-- Name field -->

<input class='tb-field' type='text' name='form_author' value="" maxlength='40' />

<label class='tb-required'>*</label>

<label class='tb-label'>Your name</label><br />

 

<!-- Email field -->

<input class='tb-field' type='text' name='form_email' value ="" maxlength='70' />

<label class='tb-required'>*</label>

<label class='tb-label'>Your email address (will not be published)</label><br />

<!-- Website field -->

<input class='tb-field' type='text' name='form_website' value="http://"  maxlength='70' />

<label class='tb-label'>Your website</label><br />

<!-- Location field -->

<input class='tb-field' type='text' name='form_location' value=''  maxlength='70' />

<label class='tb-label'>Your location</label><br />

<!-- Remember me checkbox -->

<input type='checkbox' name='form_rememberme' value='1'  /> <label class='tb-label'>Remember me</label>

<a href='/talkback/comments-help.php?height=250&width=500&name=cfh_remember_me&language=&keepThis=true&TB_iframe=true' title='' class='thickbox  help'>?</a><br />

<!-- Comment subscription radio buttons -->

<div id='tb-subscribe-line'>

<input type='radio' name='form_subscribe' value='1'  /><label class='tb-label'>Subscribe to comments</label>

<a href='/talkback/comments-help.php?height=250&width=500&name=cfh_subscribe1&language=&keepThis=true&TB_iframe=true' title='' class='thickbox  help'>?</a>

<input type='radio' name='form_subscribe2' value='2'  /><label class='tb-label'>Email replies to my comment only</label>

<a href='/talkback/comments-help.php?height=250&width=500&name=cfh_subscribe2&language=&keepThis=true&TB_iframe=true' title='' class='thickbox  help'>?</a>

</div>

 

<!-- Inserts HTML quick tag buttons -->

<div id='ed_toolbar'>

<input id='ed_bold' class='ed-button' onclick='tbInsertTag(tbcanvas, 0);' value='b' type='button' />

<input id='ed_italic' class='ed-button' onclick='tbInsertTag(tbcanvas, 1);' value='i' type='button' />

<input id='ed_under' class='ed-button' onclick='tbInsertTag(tbcanvas, 10);' value='u' type='button' />

<input id='ed_strike' class='ed-button' onclick='tbInsertTag(tbcanvas, 11);' value='s' type='button' />

<input id='ed_link' class='ed-button' onclick='edInsertLink(tbcanvas, 2, 1);' value='link' type='button' />

<input id='ed_img' class='ed-button' onclick='edInsertImage(tbcanvas, 3);' value='img' type='button' />

<input id='ed_pre' class='ed-button' onclick='tbInsertTag(tbcanvas, 9);' value='pre' type='button' />

<input id='ed_code' class='ed-button' onclick='tbInsertTag(tbcanvas, 8);' value='code' type='button' />

<input id='ed_block' class='ed-button' onclick='tbInsertTag(tbcanvas, 7);' value='quote' type='button' />

<input id='ed_lt' class='ed-button' onclick='tbInsertTag(tbcanvas, 17);' value='<' type='button' />

<input id='ed_gt' class='ed-button' onclick='tbInsertTag(tbcanvas, 18);' value='>' type='button' /><input id='ed_lightbox' class='ed-button' onclick='tbInsertLightbox(tbcanvas, 16);' value='image' type='button' />

<a href='/talkback/comments-help.php?height=500&width=520&name=cfh_buttons&language=&keepThis=true&TB_iframe=true' title='' class='thickbox  help'>?</a>

</div>

<!-- Inserts emoticon icon buttons -->

<div id='tb-form-emoticons'>

<a href='#' title='Smiling' onclick='insertCode(" :) ");return false;'><img  src='http://www.dancleary.com/talkback/images/smilies/smile.gif' alt='' /></a>

<a href='#' title='Frowning' onclick='insertCode(" :( ");return false;'><img  src='http://www.dancleary.com/talkback/images/smilies/frown.gif' alt='' /></a>

<a href='#' title='Laughing' onclick='insertCode(" :D ");return false;'><img  src='http://www.dancleary.com/talkback/images/smilies/laugh.gif' alt='' /></a>

<a href='#' title='Grinning' onclick='insertCode(" :} ");return false;'><img  src='http://www.dancleary.com/talkback/images/smilies/grin.gif' alt='' /></a>

<a href='#' title='Big grin' onclick='insertCode(" :grin ");return false;'><img  src='http://www.dancleary.com/talkback/images/smilies/biggrin.gif' alt='' /></a>

<a href='#' title='Winking' onclick='insertCode(" ;) ");return false;'><img  src='http://www.dancleary.com/talkback/images/smilies/wink.gif' alt='' /></a>

<a href='#' title='Angry' onclick='insertCode(" :angry ");return false;'><img  src='http://www.dancleary.com/talkback/images/smilies/angry.gif' alt='' /></a>

<a href='#' title='Blushing' onclick='insertCode(" :blush ");return false;'><img  src='http://www.dancleary.com/talkback/images/smilies/blush.gif' alt='' /></a>

<a href='#' title='Cool' onclick='insertCode(" :8 ");return false;'><img  src='http://www.dancleary.com/talkback/images/smilies/cool.gif' alt='' /></a>

<a href='#' title='Sticking out tongue' onclick='insertCode(" :P ");return false;'><img  src='http://www.dancleary.com/talkback/images/smilies/tongue.gif' alt='' /></a>

<a href='#' title='Sad' onclick='insertCode(" :sad ");return false;'><img  src='http://www.dancleary.com/talkback/images/smilies/sad.gif' alt='' /></a>

<a href='#' title='Evil' onclick='insertCode(" :evil ");return false;'><img  src='http://www.dancleary.com/talkback/images/smilies/evil.gif' alt='' /></a>

<a href='#' title='Bored' onclick='insertCode(" :bored ");return false;'><img  src='http://www.dancleary.com/talkback/images/smilies/bored.gif' alt='' /></a>

<a href='#' title='Confused' onclick='insertCode(" :? ");return false;'><img  src='http://www.dancleary.com/talkback/images/smilies/huh.gif' alt='' /></a>

<a href='#' title='Lips sealed' onclick='insertCode(" :# ");return false;'><img  src='http://www.dancleary.com/talkback/images/smilies/sealed.gif' alt='' /></a>

<a href='#' title='Shocked' onclick='insertCode(" :o ");return false;'><img  src='http://www.dancleary.com/talkback/images/smilies/shock.gif' alt='' /></a>

<a href='#' title='Yawning' onclick='insertCode(" :yawn ");return false;'><img  src='http://www.dancleary.com/talkback/images/smilies/yawn.gif' alt='' /></a>

<a href='#' title='Rolling eyes' onclick='insertCode(" :roll ");return false;'><img  src='http://www.dancleary.com/talkback/images/smilies/rolleyes.gif' alt='' /></a>

</div>

 

<!-- Comment subject -->

<label class='tb-label'>Subject: </label>

<input class='tb-subject-field' type='text' name='form_subject' value=''  maxlength='128' />

<!-- Comment text area -->

<textarea cols='1' rows='1' name='form_textarea' id='tbcanvas'></textarea><br />

 

<!-- HTML quick tags javascript -->

<script type='text/javascript'>var edCanvas = document.getElementById('tbcanvas');</script>

 

<!-- Submit and Preview buttons-->

<div id='tb-form-submit-line'>

<div id='tb-admin-options'>

 

</div>

<input class='tb-submit' type='submit' name='add' value='Submit' />

<input class='tb-submit' type='submit' name='preview' value='Preview' />

<label></label>

</div>

</form>

<div id='tb-error'></div> <!-- for jscript validation errors, don't remove -->

</div> <!-- end of commentForm -->

 

<div class='tb-credit'>Powered by <a href='http://www.scripts.oldguy.us' title='TalkBack comments and guestbook'>TalkBack</a> </div>

<!-- version 2.2 -->

<!-- This is a hidden div, don't change or remove it -->

<div id='tb-link-target'>1</div>

 

</div> <!--end of tb-wrapper --> </td>

 

</table>

 

<br>

 

 

 

</body>

 

</html>

 

 

Add a PHP header to the page that makes the browser refresh.

 

<?php
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
?> 

Source: http://us2.php.net/header

 

Oh, and by the way, headers must be sent before any HTML output. I.e., put the code at the beginning of your PHP file.

This is what the guy who wrote the code told me . . .

 

 

What's happening is that there is something about your php installation that is causing aberrant behavior on the part of php. Here's what is happening:

 

When you browse to http://www.dancleary.com/feedback.php feedback.php should become the "currently executing script" in php.

 

feedback.php calls head-inc.php and comments.php using include statements.

 

comments.php uses the value in the global server variable called $_SERVER['PHP_SELF'] for the url of the page that will be displayed when the user clicks on submit. When the comments.php code is executed that variable should contain " /feedback.php" because feedback.php is the currently executing script.

 

Instead, that variable contains "

/talkback/comments.php

". For some reason your php system is setting the value of

that variable incorrectly.

 

 

I did another test...I changed feedback.php to set a variable. The contents of that variable should carry through to head-inc.php and comments.php. In other words if I set variable $x = '1' in feeback.php, in comments.php if i print that variable it should print the number 1. But it doesn't, the variable shows as empty (not set). I have never seen this behavior.

 

Did you get my PM I sent you?

 

If you send me comments.php (from /talkback), I can hard-code the form action attribute and send it back to you.

 

Notice this code from the HTML code you posted above:

<form id='tb_form' name='tb_form' action='/talkback/comments.php'  method='post' onsubmit='return validateForm(this.form)'>

 

The action attribute should be action='/feedback.php'

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.