Validating a multiple-page order form

liunx

Guest
Here's what I'm trying to do...I'm trying to make an order form with multiple pages where the data is validated. Say there's several fields on a page, with a button that says something like "Next Page" or "Continue" on the bottom of the page. When you click the button, I'd like it to validate the data entered into the fields. If there is missing data or invalid data, the page appears again, where the user can fix the data. However, if everything is okay with the data, the next page will load.

Isn't there a way to do this with PHP? I've seen so many sites like this, but I can't find any examples that show me how to do it. I know how to get it to do one or the other. That is, I know how to validate the data but not move to another page, and I know how to move to the next page without validating the data, but I can't figure out how to have it do one or the other depending on the data entered (I hope that made sense). The problem is that all examples of validation I've seen are simple examples that only focus on one page.

If you know of an example that can help me here, or if you could explain what I need to do, I'd greatly appreciate it. If you need more information, please let me know. Thanks in advance.very easy.

if(this conditon is true){
load the page you want so they go to the next page
} else {

same page they came from here.
}On the same line scoutt has said..

if (trim($requiredfield1) == "" || trim($requiredfield2) == ""..) {
header("Location:formpage.php") ;
//exit() ;
}

else {
..code for ur next form page here
}

Remember that header() must be called before any actual output is sent to the browser that includes even a blank space before ur PHP open tag.

tonto
 
Back
Top