对于初学者,让我们保持一致并使用 Zend 框架。
//session_start();
//$_SESSION['prenom'] = $form['prenom']; BECOMES
$session = new Zend_Session_Namespace('name'); //will automatically call session_start if required
$session->prenom = $form->getValue('prenom');//assumes $form is a valid Zend_Form object
//$this->_view->prenom = $_SESSION['prenom']; BECOMES
$this->view->prenom = $session->prenom; //$this->_view isn't a thing as far as I know
//if you are expecting the view variable to work after redirect... it won't
//$this->_redirect('inscription'); MAY BECOME
$this_forward('inscription');//will call new action without resetting the request
现在查看脚本:
//assumes you are in the correct view script
//when accessing variables passed to the view, use $this
<input type="text" name="prenom" value="<?php
if (isset($this->prenom) {
echo $this->prenom;
}
?> " title="Prenom *" class="small"/>