i have a form i want to validate that the fields arent empty on the page of the form. i can do that no problem, but if i want to redirect to another page when they are filled out on submit and add an action to the: <form action="nextpage.php" method="POST">
it just goes to the nextpage.php before it even validates it. is there a way to validate the fields before going to the next page?
Msg#: 3962693 posted 12:45 am on Jul 31, 2009 (gmt 0)
well i can validate on next page, except i want to do it on the page of the form. and it says headers already sent, because i already sent headers at the top of the page :/ like a redirect if a person doesnt meet requirements to view the page. so im assuming i cant use headers again, unless there is another way.
Msg#: 3962693 posted 1:33 pm on Aug 3, 2009 (gmt 0)
As long as your code is in that page you can just request them via $var = $_POST['yourName']; if it's going to another page before you validate then you need to either use get on your form method or use session variables. session_start(); $_SESSION['yourName'] = $_POST['yourName']; You would need to do that on the page where they click the submit button. Now $_SESSION['yourName'] would be whatever value that post variable was, the entire time the users browser was open.