请看一下这段代码。这是个人可以编辑其详细信息的限制区域。目前我不希望个人编辑用户名和密码。是否有任何实现来保护(验证)这些字段,但细节仍应显示在文本框中。
public function blabla($lllll)
{
try {
$con = new PDO( DB_DSN, DB_USERNAME, DB_PASSWORD );
$con->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
$book = "SELECT * FROM x WHERE id =".$usr;
$stmt = $con->prepare($book);
$stmt->execute();
$get = $stmt->fetch(PDO::FETCH_ASSOC);
$ts = new Account;
echo("<div id='box'>
<div class='box-header'>". $get['']."</div>
<div class='box-content'>
<form method='post'>
<table width='50%'>
<tr>
<td>Name:</td>
<td><input type='text' size='0' name='name' value='".$get['name']."' /></td>
</tr>
<tr>
<td>Surname:</td>
<td><input type='text' size='0' name='surname' value='".$get['surname']."' /></td>
</tr>
<tr>
<td>Username:</td>
<td><input type='text' size='0' name='username' value='".$get['username']."' /></td>
</tr>
<tr>
<td>Password:</td>
<td><input type='text' size='0' name='password' value='".$get['password']."' /></td>
</tr>
<tr>
<td>E-mail:</td>
<td><input type='text' size='0' name='email' value='".$get['email']."' /></td>
</tr>
");
echo("</table></form></div></div>");
}catch( PDOException $e ) {
return $e->getMessage();
}
}