0

In my controller, i want to send a variable to a certain view before redirecting the user to it:

class IndexController extends Zend_Controller_Action {

      public function permissionAction() 
      {
    /*....*/
              $this->view->inscription->email = $params['email'];

              $this->_redirect('/inscription'); // redirection to the inscription view

      }
}

In my inscription view: i try to get the variable with this:

<?php echo $this->email; ?>

But it's not working...(displays "null") Can anyone help me? Thanks in advance

1 Answer 1

0

Variables you assign to the view only last for the duration of the current request. Since you are redirecting the user to another URL (telling their browser to make another request to /inscription), that data is lost.

Either render the data in the permissions action, use _forward instead of _redirect, or store the data in the session. It's hard to know which of these is most appropriate without knowing exactly what this action and the inscription action do.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.