|
Posted by ZeldorBlat on 06/10/06 02:56
wisebede@yahoo.co.uk wrote:
> Hello. I've got a PHP page with a form. When the form submits, it
> submits back to the same page for validation. If validation passes, I
> want to redirect to one of several pages depending on which option was
> chosen.
>
> That works fine, but I also want the details on the form to be
> available to the $_POST requests on the receiving pages. Now I had
> expected the a header redirect would make the request variables
> available to the next page too, but that doesn't seem to happen. The
> request variables are cleaned out.
Yep. Tell the browser to go somewhere else, and the browser will make
a request for that new page. Since it's a new request, the form
variables don't travel with it.
>Is that correct, and is there a way
> to pass the form details on to the receiving page? (I could use a
> session I suppose, but that would mean having to copy the form
> variables out of the form and into a session variable. I don't want to
> explicitly do that unless I have to).
You could instead copy the $_POST variables into the URL that you
redirect the browser to. But why not put it in a session? You don't
even need to copy each one by itself. For instance, on the page that
validates and redirects, why not just:
$_SESSION['formVars'] = $_POST;
>
> Thanks for any help at all,
>
> Matt.
> Manchester, UK.
Navigation:
[Reply to this message]
|