为什么我的$Post操作不起作用


Why is my $Post action not working

在我的代码中,我有 2 个表单和 2 个操作(一个用于更改密码详细信息,另一个用于更改客户名称)。单击该按钮时,表单将数据提交到处理 SQL 语句的 UpdateCustomer.php 页面。

    <ul>
      //this form action works
        <form action="Functions/Customer/UpdateCustomer.php" form name="CustomerDetails" method="post">
        <li><label for="Name">Name</label>
        <input type="text" name="updateName" value="<?php echo $row_Customers['Customer_Name'] ?>" style='width:300px;'/><button>Update</button></li>   
        </form> 
        <br />
      //this form action doesn't
        <form action="Functions/Customer/UpdateCustomer.php" form name="ChangePassword" onSubmit="return validateForm()" method="post">
         <div class="pass" ><label for="password">Password</label>
        <input type="password" name="updatePassword" id="updatePassword" value="" style='width:300px;'/></div>
        <div class="pass" ><label for="confirmPassword">Confirm Password</label>
        <input type="password" name="confirmPassword" value="" style='width:300px;'/><button>Change Password</button></div>
        </form> 
    </ul>

然后.php我的 UpdateCustomer 检索这些变量:

$Name = $_POST['updateName'];
$Password = $POST['updatePassword'];

当我在$Name上执行回显时,如果我已提交"客户详细信息"表单,它会显示输入的名称,但是当我在提交"更改密码"表单后对$Password进行回显时,我没有得到任何值。

任何帮助都非常感谢!

谢谢

您有语法错误,请更改

$Password = $POST['updatePassword'];

$Password = $_POST['updatePassword'];

它应该是 $_POST['updatePassword'] 而不是 $POST['updatePassword']

你也可以这样做:

$post = _POST 美元;

所以$post['更新密码']