RE: [PHP] Self-Process php forms or not?
| From: | MEM | Date: | Fri, 02 Oct 2009 00:16:25 +0000 |
| Subject: | RE: [PHP] Self-Process php forms or not? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-298455@lists.php.net to get a copy of this message | ||
Thanks a lot to all,
I will see what best fits my limited knowledge, and choose the possible
option.
Regards,
Márcio
> -----Original Message-----
> From: Tom Worster [mailto:fsb@thefsb.org]
> Sent: quinta-feira, 1 de Outubro de 2009 20:11
> To: tedd; 'PHP-General List'
> Subject: Re: [PHP] Self-Process php forms or not?
>
> On 10/1/09 10:13 AM, "tedd" <tedd.sperling@gmail.com> wrote:
>
> > At 1:00 PM +0100 10/1/09, MEM 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?
> >
> >
> > MEM:
> >
> > Here's what I do -- it's pretty simple.
> >
> > I use a hidden input variable I call "step" and monitor it as the
> > user clicks whatever form submit they are on -- it works like so:
> >
> > $step = isset($_POST['step']) ? $_POST['step'] : 0;
> >
> > switch ($step)
> > {
> > case 0: // present the first form to the user
> > // collect data
> > // you can enhance the user experience by using javascript here.
> > // <input type=hidden name=step value=1>
> > break;
> >
> > case 1: // present second form to the user
> > // clean data
> > // if data OK then record data in db <input type=hidden name=step
> value=2>
> > // if data not OK then send user back <input type=hidden name=step
> value=0>
> > break;
> >
> > case 2: //present the third form to the user
> > // success, or confirmation, or thank you page
> > break;
> > }
> >
> > Now, to make things easier for the user, be sure to set session
> > variables for all the data collected in the first form so that IF you
> > send the user back to the first form, the user doesn't have to
> > reenter everything.
>
> i do pretty much the same thing. each form in my html template files
> has a
> form name tucked away in a hidden input element. the only difference
> from
> your method is that the names are unique across the application.
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php