0

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

这是我的更新声明

    $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>
4

2 回答 2

2

Where is the input element named emailtm? In your form, you haven't included it. So probably that might be the issue.

You haven't included in the form, but you are accessing it in your php code via the $_POST !

$_POST is an associative array which contains the name-value pair of the input elements you have submitted via the form.

于 2012-07-29T05:13:45.543 回答
0

如果您还可以查看 apache 日志文件以查看是否有任何错误,那就太好了。不知何故,我看到您需要在查询中将 password 和 password_hidden 的值括在引号中。

$updateSQL = sprintf("UPDATE user SET password='%s' WHERE password_hidden='%s'",
                   GetSQLValueString($_POST['password'], "text"),
                   GetSQLValueString($_POST['password_hidden'], "text"));
于 2014-11-05T05:58:57.413 回答