Re: Self-Process php forms or not?
| From: | Ashley Sheridan | Date: | Thu, 01 Oct 2009 13:35:00 +0000 |
| Subject: | Re: Self-Process php forms or not? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-298439@lists.php.net to get a copy of this message | ||
On Thu, 2009-10-01 at 09:30 -0400, Tom Worster wrote:
> On 10/1/09 8:00 AM, "MEM" <talofo@gmail.com> wrote:
>
> > One last question about this:
> >
> > I've done a self submit form, after hearing all the advantages expressed
> > here.
> > But how could we relate, without using javascript, a self submit form with a
> > "success page" or a "confirmation page" that doesn't show the
> > form?
> >
> > Can please someone throw me some infos about this please?
>
> i use one php script that knows how to deliver more than one html page
> depending on the outcome of processing of form input and the rest.
>
> i'm sure there are other ways.
>
>
>
The way I always tend to do something like this is as follows:
$errors = false;
if(isset($_REQUEST['submit']))
{
// process form here
// if it doesn't validate $errors to true
// you can either redirect here, or display the confirmation message
}
if(!isset($_REQUEST['submit']) || $errors)
{
// display form
// if $errors is true populate the form with user submitted data
}
Thanks,
Ash
http://www.ashleysheridan.co.uk