Re: [PHP] How to create an intermediary page between two pages

2009-05-23 Thread tedd

At 2:20 PM +0200 5/23/09, Moses wrote:

Hi Folks,

I would like to know whether you can connect two pages via
an intermediary page. For example if you have main.php, which is a form
whose action is directed to function.php. Function.php process the
information from main.php then displays the result. This can take
roughly 6 seconds or more. Is it possible to create an intermediary page
which alerts the user that the his/her request is being processed in few
seconds,
then ultimately redirects to function.php (display results).

Any idea shall be appreciated.

Thanks.

Moses


Moses:

Two things:

1. Anytime the user has to wait, provide a notice of what's 
happening, such as wait gif to let them know something is happening. 
Here are some examples:


http://webbytedd.com/bb/wait/

2. Why two scripts? Why not just create a single script?

I often have a single script that simply submits forms to itself and 
evaluates the contents. If the contents pass inspection, then the 
script moves on to the next step. If not, then the script shows the 
user where the problem is and ask for the user to fill the form out 
correctly.


I often couple this with javascript to provide more immediate 
interaction with the user, such as checking proper email format, 
password and password-confirmation being equal, input required 
fields, and other client-side stuff. This helps with preparing the 
data before submission. But I ultimately check and validate all 
incoming data server-side before doing anything important with it.


There's no rule that says everything must be done in separate pages/scripts.

Consider this, use a $step variable and set the initial value to 0. 
Drop the user into the first form and use a input type='hidden' 
name='step' value='1' within that form.


When the user clicks submit, then $step = $_POST['step'] will equal 1 
and process the data submitted via a switch or if statement. If 
everything is Okay, then continue to the next part. If not, then set 
$step=0 and start over again.


Some of my forms have up to ten steps and that's the way I do it.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] How to create an intermediary page between two pages

2009-05-23 Thread Moses
Dear Folks,

Thanks Tedd for the reply. Do you have a simple example to ilustrate
your great idea.

Thanks.

On Sat, May 23, 2009 at 3:47 PM, tedd tedd.sperl...@gmail.com wrote:

 At 2:20 PM +0200 5/23/09, Moses wrote:

 Hi Folks,

 I would like to know whether you can connect two pages via
 an intermediary page. For example if you have main.php, which is a form
 whose action is directed to function.php. Function.php process the
 information from main.php then displays the result. This can take
 roughly 6 seconds or more. Is it possible to create an intermediary page
 which alerts the user that the his/her request is being processed in few
 seconds,
 then ultimately redirects to function.php (display results).

 Any idea shall be appreciated.

 Thanks.

 Moses


 Moses:

 Two things:

 1. Anytime the user has to wait, provide a notice of what's happening, such
 as wait gif to let them know something is happening. Here are some examples:

 http://webbytedd.com/bb/wait/

 2. Why two scripts? Why not just create a single script?

 I often have a single script that simply submits forms to itself and
 evaluates the contents. If the contents pass inspection, then the script
 moves on to the next step. If not, then the script shows the user where the
 problem is and ask for the user to fill the form out correctly.

 I often couple this with javascript to provide more immediate interaction
 with the user, such as checking proper email format, password and
 password-confirmation being equal, input required fields, and other
 client-side stuff. This helps with preparing the data before submission. But
 I ultimately check and validate all incoming data server-side before doing
 anything important with it.

 There's no rule that says everything must be done in separate
 pages/scripts.

 Consider this, use a $step variable and set the initial value to 0. Drop
 the user into the first form and use a input type='hidden' name='step'
 value='1' within that form.

 When the user clicks submit, then $step = $_POST['step'] will equal 1 and
 process the data submitted via a switch or if statement. If everything is
 Okay, then continue to the next part. If not, then set $step=0 and start
 over again.

 Some of my forms have up to ten steps and that's the way I do it.

 Cheers,

 tedd

 --
 ---
 http://sperling.com  http://ancientstones.com  http://earthstones.com



Re: [PHP] How to create an intermediary page between two pages

2009-05-23 Thread tedd

At 4:34 PM +0200 5/23/09, Moses wrote:

Dear Folks,

Thanks Tedd for the reply. Do you have a simple example to ilustrate
your great idea.

Thanks.


Moses:

It's not a great idea, just a simple solution to a common problem -- see here:

http://www.webbytedd.com/b3/step-example/

Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php