当验证失败时,我想将用户名保留在表单中。这适用于此,但问题是它还在成功后将用户名保留在表单中。我该如何解决这个问题?
public function RegisterForm(){
if (isset($_SESSION['m_username'])&& isset($_POST[$this->m_username])){
$_SESSION['m_username'] = $_POST[$this->m_username];
} else {
$_SESSION['m_username'] = "";
}
return
'<form method="post">
<label class=label>Username:</label>
<input type="text" name="'.$this->m_username.'" value="'.$_SESSION['m_username'].'" />
........
</form>';
}