得到一个等待参数的动作,要运行这个动作,我总是需要一个参数。但同样在这个动作中,我对其他表单进行验证,之后我的第一个变量总是消失。$var
在 isValid 之后我如何保持这个?
public function myAction(){
if ($this->getRequest()->isPost() || $this->getRequest()->getParam('number')){
//this is where got my number
$number = $this->getRequest()->getParam ('number');
//and use to display site.
if ($this->getRequest()->isPost()){
if($commentForm->isValid($this->getRequest()->getPost())){
//if I get Valid data I do upload or etc.
} else {
//but if form is inValid won't display everything one more time.
//but **$number is now Null**.
$this->view->data = $tUser->getCommentAndUserByTelephone($number);
$this->view->commentForm = $commentForm;
}
}
}
}
我怎样才能在$number
不重新发布的情况下保留它?