Re: Self-Process php forms or not?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/1/09 10:13 AM, "tedd" <tedd.sperling@xxxxxxxxx> 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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux