[nycphp-talk] Need page refresh solution after form data processing
Keith J Richardson
Keith.Richardson at thompsonhealth.com
Fri Dec 19 13:58:13 EST 2003
If you would wish to have the page show the origional form with a success variable - then you could have the mail sent, and header back to itself with a get variable, say header("location: ".$_SERVER['PHP_SELF']."?success=true"); or success = false, which then the form page would check to see if the variable exists, and display a message:
if (!empty($_GET['success']))
{
if ($_GET['success'] == "true")
{
print("Your mail has been sent");
}
else
{
print("Your mail was not sent.");
}
}
hope that helps any.
-----Original Message-----
From: talk-bounces at lists.nyphp.org
[mailto:talk-bounces at lists.nyphp.org]On Behalf Of Daniel Kushner
Sent: Friday, December 19, 2003 1:29 PM
To: NYPHP Talk
Subject: RE: [nycphp-talk] Need page refresh solution after form data
processing
Scott,
After processing the form, you can redirect (header('Location: page.php');
exit;) to another page that has some 'Form has been processed' message. If
the user hits refresh, he/she won't be resubmitting the form.
Best,
Daniel Kushner
> -----Original Message-----
> From: talk-bounces at lists.nyphp.org
> [mailto:talk-bounces at lists.nyphp.org]On Behalf Of
> tech at protchkocreative.com
> Sent: Friday, December 19, 2003 1:23 PM
> To: NYPHP Talk mailing list
> Subject: [nycphp-talk] Need page refresh solution after form data
> processing
>
>
>
> I am trying unsuccessfully to eliminate the browser warning that
> it "can't
> refresh the page without re-submitting the form data" when
> refreshing my form
> page after it is submitted. Though refreshing the page wouldn't
> be typical, I
> want to eliminate any potential user confusion.
> Browser: IE6
>
> The form is processed as:
> <FORM NAME="request" action="<?php echo $_SERVER['PHP_SELF']; ?>"
> METHOD="POST">
>
> which then takes some action in the form:
>
> if($beenSubmitted) {
> //concatenate results
> ...
> //mail results
> }
>
> AND serves the form again!
>
> I have some sense it has to do with caching of header info. I have
> unsuccessfully tried various header("xyz'); statements after
> processing the
> form and before serving the HTML, including many suggested in the
> documentation. I have googled. Again, haven't found suggestion
> that works, or
> that I'm implementing correctly. I am not very knowledgable in
> the smoke 'n
> mirrors of HTTP headers.
>
> I appreciate any thoughts on this.
> Scott Protchko
> tech at protchkocreative.com
>
>
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
>
_______________________________________________
talk mailing list
talk at lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk
More information about the talk
mailing list