On Thursday 02 September 2004 16:37, Francis Chang wrote: > I have a newbie question related to validating required Form fields. > > Suppose we have a two-step user registration process with scripts > register1.php and register2.php, each page containing a set of required and > non-required fields. In register1.php, when user submits the form, it > calls register2.php as the action. In register2.php, I want to validate > the Form values submitted by the user in register1.php and if any of the > required fields is missing a value, I want to re-dispaly the register1.php > page with the appropriate error message. > > What is the most appropriate way to handle this? Once the validation fails > in register2.php, can I call register1.php with parameters?
No. I'm assuming that the form in register1.php is created using pph, so when you construct that form, plugin the values that were submitted. At the same time you can highlight the items that were invalid. > Or do I use session variables to capture the error information? That would be best although you would have to make sure the client accepts (session) cookies and/or enable transparent sessions support in PHP. > How do I > redirect to register1.php from within the code execution of register2.php? header("Location: http://www..."); There are many ready made code which does all this and more for you. Check out www.phpclasses.org -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general ------------------------------------------ /* He laughs at every joke three times... once when it's told, once when it's explained, and once when he understands it. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php