/    Sign up×
Community /Pin to ProfileBookmark

Page does not refresh after submit

I have a comment/feedback page on my website and after I enter the information and hit submit I would like the same page to refresh with the new information added, but instead it is being redirected. I know very little about php. The web page is [url]http://www.dancleary.com/feedback.php[/url]. Here is what the originator of the code said about the problem . . .

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 [url]http://www.dancleary.com/feedback.php[/url] 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

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@malarzAug 19.2007 — Each form You have has action=".../comments.php". I don't know how it looks like, but if comments.php don't say that browser should return to feedback.php it won't happen. If You include comments.php it is not necessary to go there after submit, so change forms' action to action="".
Copy linkTweet thisAlerts:
@cleary71authorAug 19.2007 — I think I did what you just said and it did refresh, but it didn't include the comment I just posted. I will revert back to the original code for now.
Copy linkTweet thisAlerts:
@malarzAug 19.2007 — If action was comments.php and there was no other parameters, it should work if some $_POST variable is set, so if You include comments.php at the very top of feedbacks.php (after important includes, let's say before showing comments that were posted earlier) it will do it's stuff and insert comments into database (or wherever else) so new comment will already be in database where "showing query" executes. That's how I'd wrote script and I think it works this way - maybe I'm wrong ?
Copy linkTweet thisAlerts:
@cleary71authorAug 19.2007 — I am not sure I completely understand. If I were to send you the two files, could you tweak them for me?
Copy linkTweet thisAlerts:
@malarzAug 19.2007 — Yes, of course, send me a PM, but I can't tell You when I will read code You'll send because I've got plenty of job and I hardly find time for other things
×

Success!

Help @cleary71 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...