What is the best way to process a form when you want to display the results on a different page & keep the session variables?
I have a form that I'm trying to process and if the user does not enter required information in certain fields they are kept at the same page with the error displayed about which required fields they need to fill out before they can proceed.
So, I'm trying to post the info from edit.php to results.php. My form action on edit.php is edit.php & then I'm using header() in an if/then statement if all variables are filled out.
But when I try to redirect with header() my session variables don't convert, nor does the $_POST variables convert.
Is there a better way to do this without having to query the database to restore all my variables or is this the best way to process the form?
I have action set to the same page for a user error loop, such as you didn't not fill out username.
Then, if they successfully enter all the required fields, I will send them to results, via header(location:results.php). But, when header is called, it doesn't have any of the $_POST nor $_SESSION variables.
So, how do I get my variables back into the session? Or should I handle my user error messaging differently?