views:

111

answers:

2

Hi,

After form (method POST) submission i want redirect user to specific page.

usually i used simple line

header("Location: /path/to/redirect/");
exit;

The Zend_Controller_Action have method _redirect example:

$this->_redirect("/path/to/redirect/");

But it have one simple problem: if i refresh page (press F5) last controller action is activated. So its like double post.
Of course i can use old fashion way, but I just want find the zend style redirect.

Edit: p.s after post redirect i want have cleaned form data. Of course i can use own method with header("location:/path") but I searching it implemented in standart zf

Any ideas?

A: 

Set a session variable that data has been posted, if not post data, redirect?

snkmchnb
I think the point of his question, the ZF redirect helper leaves the posted data hanging around and a refresh tries to re-submit it. Even if he puts in the usual safegaurds for protecting against a repost the user gets the annoying 'You are about to resubmit data' pop-up. I assume his question is, is there something better/different/more preferred than using the `header` redirect method that removes the form data.
manyxcxi
@manyxcxi: yes you are right. I just want remove form data after redirect.
Vaidas Zilionis
@snkmchnb: i don't need post data saved (thats is'nt problem). I just want find zend way to do redirect and form data cleaned.
Vaidas Zilionis
@Vaidas Zilionis i didn't understand that from your original post
snkmchnb
+1  A: 

I think thats because _redirect uses an internal redirect. You need to use an external one. You need to use the Redirector action helper directly... in your action:

$this->_redirector->gotoUrlAndExit($url);
prodigitalson
ok so it's simple header("Location: /path") :)
Vaidas Zilionis