Forum Moderators: coopster

Message Too Old, No Replies

Loading a new page after logic test

If all the entries validate, switch to a different page

         

wildeyedfrank

11:34 am on Mar 10, 2005 (gmt 0)

10+ Year Member



Question:-->Can I display a "validating entries" screen during the validation, then redirect the current screen to load a new page if it passes?

A little background:
I have a somewhat long php script (12 pages) that provides an optional login function; collects and validates the customer's information.

The first time it loads the button reads VALIDATE

When that is pushed it posts back to itself and performs the validation routine, then either highlights problem areas and keeps the VALIDATE button or changes it to CHECKOUT if successful.

In my initial testing program (watching my wife try and use it) I can see that this is going to be a point of major confusion.

Any tips would be appreciated!

coopster

3:41 am on Mar 12, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Sure can. Check out the PHP Output Control Functions [php.net], like flush() perhaps. Also, there is a PEAR class called HTML_Progress [pear.php.net] that may be of interest to you. If you don't feel like invoking PEAR, you can still take a peek at how the package works ...

wildeyedfrank

7:10 pm on Mar 26, 2005 (gmt 0)

10+ Year Member



Sorry, just noticed your reply.

Your suggestion worked great except for one issue I can't seem to think my way out of.

The new page (I now load by using header() right after dumping the output buffer) can't get all the $_POST variables from the page I just quit.

(collecting address, posts back to self for validation, NOW moves to checkout if everything is valid...but no <input type...> data comes with it).

I'm not sure where all that data is stored (or I might have an idea what to do to fix this)...should I continue with the output buffering to the end of the script, pull the contents of the buffer, do something with it, then kill the buffer and move to the new page?

I really appreciate your help. Really learned something unexpectedly usefull!

coopster

8:26 pm on Mar 26, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



You could read them in from the $_POST array and write them back out in <input type="hidden"> elements which get applied before you flush the buffer. Or you could store them in a $_SESSION.

wrightee

12:05 am on Mar 28, 2005 (gmt 0)

10+ Year Member



Even more fun:

header("HTTP/1.0 307 Temporary redirect");
header("Location: "someurl.php");
exit;

That just takes your $_POST vars and everything else and points it at a different page, no reload, no hidden vars and no mail in rebate.