So I'm building a web application that I am currently only using jQuery/Javascript to validate data. I'd like to add some server-side PHP validation in addition to the client-side jQuery, but I'm not so clear on how to achieve this with my current setup...

Here's my setup:
I have a Form A (a dropdown, a series of checkboxes, and set of radio buttons). Upon submit, this information is used to generate a price quote on Form B. On Form B, I use the information from Form A and some new fields that are used to generate a shipping label (First Name, Last Name, Street, City, State, Zip Code, Email, Phone Number, Radio Buttons, and Terms and Conditions Check Box). I then use all this info on Form B to generate that shipping label in a process script which also sends confirmation email too. (which I'll call "Page 3").

So now, I basically have three pages. What I'd like to do is make the Dropdown and Radio Buttons Required on Form A required before the user can get to Form B and then validate some of this data before the user can get to the process form. I see a lot of tutorials that use same page validation by either processing the form on the same page or to a server, but in my case I want to use this information on following pages. Is there some way to check data on the same page and if the data passes then process to a following page? Any advice, resources, or help is much appreciated! I am happy to share the code if you some working solutions.

Thanks in advance!

    Do you know of any resources or tutorials that may be helpful. I appreciate your help, but for my skill level, I don't know if that's enough to get started with. Look forward to hearing back!

      There's a basic example of session use on the http://www.php.net/session.examples.basic page, and another on the [man]session_start[/man] page. In your case:

      1. Display Form A, which submits to page B.

      2. On page B, start a session and store the results from form A in it; then display form B (which submits to page 3)

      3. On page 3, restart the session and get the results from Form A out of it, and combine it with the results from form B.

        You can also use hidden variable for data passing....🙂

          Thank you both for the feedback. Think I figured it out. I processed Form A to itself, validated the info. If all validation passed, I used a header to go to Form B which I passed the info through using Sessions. Because I wasn't processing the form on the following page I couldn't use a post variable in hidden form field, so instead, I passed an ID which I assigned to two separate sessions, one through the URL, the other through a session. I then checked both of the values for equality on Form B. If they weren't equal, I used a header to redirect back to form A (this will also prevent from users going directly to this page). I will use the same technique to validate and process to the final and third page.

          Whether it's the best method, I'm not sure....still learning, but it seems to work great! Any feedback is appreciated and thank you both for the help!

            Write a Reply...