我的policyInfoAction
将我的表单重定向到clientInfoAction
。它存储空字段错误,然后验证会话变量中的字段,如果它包含错误,则将其重定向到client-info
页面。
它工作正常。但问题是,下次我在新标签页中点击/client-info
页面时,它会在字段中显示表单值。我必须点击刷新页面才能清除它。当我在新选项卡中打开链接时,我不希望它显示缓存数据。我该怎么办?
public function clientInfoAction(){
//If there are some errors and some valid fields, display the valid fields
$client=$this->session->client;
$state=$this->session->state;
unset($this->session->client, $this->session->state); // delete from the
// assign the values to the view
$this->view->client = $client;
$this->view->state = $state;
}
以下是我的观点:
<form action ="/pdp/policy-info/" method='post'">
<label for="client_name">Client Name: </label>
<input type="text" name="client_name" id="client_name">
<?php if (!empty($this->client_error)) echo "<font size='2' color ='#C11B17'>".$this->client_error."</font>"; ?>
<br><br>
<label for="state">State: </label>
<select name="state" id='state'>
<option id='state' value="" selected="selected"></option>