Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID

Go back to referer

I'm trying to redirect to the referer (which is not the admin handler) after saving a form (add/edit).

I foolishly tried to save the referer in this way

if (! $form->submit ()) {
    $form->data->referer = $_SERVER['HTTP_REFERER'];
};

in order to pass it in place of '/myapp/admin'

$form->controller->redirect ('/myapp/admin');

but the information is lost. Is it possible without using a session variable?

Thanks.

Comments

  • If you're adding the referrer to $form->data, you could create a hidden field with it:

    <input type="hidden" name="referrer" value="{{referrer}}" />
    

    Then you can check if (! empty ($_POST['referrer'])) to see if you should redirect.

  • Yeah, thanks. (can't see the forest for the trees)

  • Just ran into a need for this. Thanks, guys!

Sign In or Register to comment.