Re: QuickForm: want to send user back to referring page - but form is processed by form itself so it only displays again - tried
$_SERVER["HTTP_REFERER"]
| From: | Justin Patrin | Date: | Mon, 10 Jan 2005 16:16:50 +0000 |
| Subject: | Re: QuickForm: want to send user back to referring page - but form is processed by form itself so it only displays again - tried $_SERVER["HTTP_REFERER"] |
||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-16861@lists.php.net to get a copy of this message | ||
On Mon, 10 Jan 2005 06:26:02 -0800 (PST), l Burnerheimerton
<lburnerheimerton@yahoo.com> wrote:
> I've tried several ways to get the user back to the
> page that sent them to the form (quickform form) -
> form is set up to add or edit depending on $_GET
> variable.
>
> For example user goes to pageA. From pageA, they
> choose to enter data on formA. After they add data
> then submit and it should send them back to pageA.
>
> The same user later goes to pageB and selects on a
> piece of data they want to edit. They are sent to
> formA where they edit the data then need to be sent
> back to pageB.
>
> In my code, I have tried $_SERVER["HTTP_REFERER"] but
> that doesn't work since when the form is submitted, it
> looks like it was submitted from formA rather than the
> page that got the user there.
>
> I've tried a combination of hidden fields, tried
> assigning variables in the callback function but those
> can't seem to be read in the validate funciton.
>
> Any ideas?
>
When you submit the form, the referer is indeed the form itself.
When the user goes to the form page, check the referer. If it's not
the form page, save it in the session (or a hidden var or a cookie or
whatever). Then when you process the form, look for it and redirect if
it exists.
--
Justin Patrin