I know this has been answered somewhat but I can't seem to get it work for my specific config. Apologies if this is deemed a duplicate.
I have a cart built in Zend with a button that points to a login page via:
if(!$session->id)
{
header('Location:'.$fullurl.'login');
}
The button is inside a form by itself. I've tried Arne's suggestion below with no dice. Form code:
<form name="" action="' . $fullurl . 'continue" method="post">
<input type="submit" name="topay" value="CONTINUE SHOPPING" />
</form>';
How do I get and redirect to the last page visited rather than going to /login?
I've tried doing the old HTTP_REFERER method but couldn't get it to work in Zend.. I understand there's a different method in Zend but can't get it to work from various answers here and here.
Any help is greatly appreciated.
I would use this:
$url = Zend_Controller_Front::getInstance()->getRequest()->getRequestUri();
$session = new Zend_Session_Namespace('Namespace');
$session->redirect = $url;
// redirect
$this->_redirect($url, array('prependBase' => false));