>我有一个表格 - 接下来只附加了它的一部分。
我有一个脚本,如果我愿意,可以将输入密码类型更改为文本。我的问题是,如果我单击"更新"而输入"Password_field"输入类型为"密码",表单会从所有字段发送信息。
我想要的是,当"Password_field"输入类型为"密码"时,表单不会从"Password_field"输入发送信息 - 跳过它。仅当"Password_field"输入类型为"TEXT"时,我才想保存此 spacific 字段中的数据。
基本上,我希望表单在任何情况下都保存所有字段中的信息,但如果他的类型是"密码",我会跳过"Password_field"输入。
最简单的方法是什么?以及如何?:)
有什么建议吗?
德克萨斯
<?php
$sql = "SELECT DBTABLE, Full_Name, Phone, Password FROM Names WHERE id='" . $id . "'";
$result = $conn->query($sql);
$resultArr = array();
$i = 0;
if (isset($result->num_rows) && $result->num_rows > 0) {
// output data of each row
if ($row = $result->fetch_assoc()) {
$Full_Name = $row["Full_Name"];
$Phone = $row["Phone"];
$Password = $row["Password"];
}
}
}
?>
<form action="" method="POST">
<input type="hidden" name="id" value="id"/>
Full_Name
<input style="margin-top:10px; margin-bottom:15px;" id="Full_Name" type="text" name="Full_Name" value="Full_Name"/>
Phone
<input style="margin-top:10px; margin-bottom:15px;" id="Phone" type="text" name="Phone" value="Phone"/>
-- > Password_field
<input style="margin-top:10px; margin-bottom:15px;" id="Password_field" type="password" name="Password_field" value="***"/> <---
<input type="submit" name="submit" value="Update" style="margin-left: 4px; font-size: 18px;"/>
</form>
您可以在提交之前禁用密码字段。检查输入类型是否为密码,然后禁用它并提交表单。不会提交已分发的字段。