gpt4 book ai didi

PHP 密码更新表单未写入数据库

转载 作者:行者123 更新时间:2023-11-29 08:49:21 25 4
gpt4 key购买 nike

现在我卡在更新密码区域,我尝试键入新密码,然后单击更新按钮,但数据库未更新,这里的任何人都可以帮助我错误在哪里?

这是我的更新声明

    $editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE user SET password=%s WHERE password_hidden=%s",
GetSQLValueString($_POST['password'], "text"),
GetSQLValueString($_POST['password_hidden'], "text"));

这是我的表格

<form method="POST" name="form1" action="<?php echo $editFormAction; ?>">
<table border="0" align="center">
<tr>
<td width="130"><span class="style5">New Password</span></td>
<td width="15"><div align="center" class="style5">:</div></td>
<td ><label><input name="password" type="password" id="password" tabindex="1" value="<?php echo $row_chgpswd['password']; ?>" size="20" />
<input name="password_hidden" type="hidden" value="<?php echo $row_chgpswd['password_hidden']; ?>" />
</label>
</td>
</tr>
<tr>
<td height="26">&nbsp;</td>
<td>&nbsp;</td>
<td><div align="right">
<input type="submit" name="button" id="button" value="Change Password" tabindex="3"/>
</div>
</td>
</tr>
</table>
<input type="hidden" name="MM_update" value="form1">
</form>

最佳答案

名为 emailtm 的输入元素在哪里?在你的表格中,你没有包含它。所以这可能就是问题所在。

您尚未包含在表单中,但您正在通过 $_POST 在 php 代码中访问它!

$_POST 是一个关联数组,其中包含您通过表单提交的输入元素的名称/值对。

关于PHP 密码更新表单未写入数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11706838/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com