i have a registration area that has 3 forms on 3 seperate pages, when you click the submit button on each page you are taken to the next page.

how can i validate this form so that if for example:

$password1 and $password 2 do not match echo "passwords do not match, please correct this before you can continue" otherwise redirect user to next page.

the problem im having is the user is redirected and the error is echoed on the new page.