I'm trying to populate a HTML form with data saved in session. This is what i've done so far but it's not working:
In my controller:
$sessionErrorForm = new Zend_Session_Namespace('errorForm');
$sessionErrorForm->prenom = $form['prenom'];
$this->_redirect('/inscription');
In my view, i need to display something in the value field if a session exists:
<div><input type="text" name="prenom" value="<?php if (isset($sessionErrorForm->prenom)): echo $sessionErrorForm->prenom; endif;?>" title="Prénom *"/>
Thanks in advance for your help
Ok. Same thing like here. You always have to instantiate your Session before you can access it. You can declare it in your controller:
And access it in your view with
$this->sessionErrorForm
:Or you can declare it in your view and use it like the following:
But nevertheless if you write into your session in a previous request you always have to create a new reference to your session, if you don't declare it in the scope before.