post 使用 $_SERVER["SCRIPT_NAME"] 更新用户密码 return 500(内部服务器错误)

post an update user's password using $_SERVER["SCRIPT_NAME"] return 500 (Internal Server Error)

我想更新用户的密码并放置 $_SERVER["SCRIPT_NAME"] 这样我就可以在用户不转到另一个页面的情况下进行更新。但我死于尝试。这里是..

history.php

<?php
$namamenu = $stat = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$namamenu = test_input($_POST["nameMenu"]);

if(!empty($_POST) && $namamenu="datalogin"){
    $pass = test_input($_POST["pass"]);
    $passnew1 = test_input($_POST["passnew1"]);
    $passnew2 = test_input($_POST["passnew2"]);
    $result = $conn->prepare("SELECT password FROM profile WHERE id=?");
    $result->bind_param('i', $getid);
    $result->execute();
    $result = $result->get_result();
    $result = $result->num_rows;
    if($result!=0){
        if($passnew1 == $passnew2){
            $result = $conn->prepare("UPDATE profile SET password=? WHERE id=?");
            $result->bind_param('si', $passnew1, $getid);
            $result->execute();
            if ($result == TRUE){
                $stat = "<div class='alert alert-success fade in'><a href='#' class='close' data-dismiss='alert' aria-label='close'>&times;</a><strong>User: '".$getemail."' updated successfully</strong></div>";
                $result->close();
            }else{
                $stat = "<div class='alert alert-danger fade in'><a href='#' class='close' data-dismiss='alert' aria-label='close'>&times;</a><strong>Error: </strong>".$conn->error."</div>";
            }
        }else{
            $stat = "<div class='alert alert-danger fade in'><a href='#' class='close' data-dismiss='alert' aria-label='close'>&times;</a><strong>Password Not Match!</strong></div>";
        }
    }else{
        $stat = "<div class='alert alert-danger fade in'><a href='#' class='close' data-dismiss='alert' aria-label='close'></a><strong>Wrong Password!</strong></div>";
      }
  }

}

function test_input($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
?>

那么我这里是用户界面,顺便说一句,我使用 bootstrap 2.x

<!-- DATA LOGIN -->
      <div class="tab-pane" id="datalogin">
        <div class="row">
            <div class="span2"></div>
            <div class="span8">
            <form role="form" name="frm_datalogin" method="POST" action="<?php echo htmlspecialchars($_SERVER["SCRIPT_NAME"]);?>">
                <div class="row">
                <center><h4>Form Data Login</h4></center>
                <div class="span4">
                <input type="hidden" name="nameMenu" value="datalogin">
                <div class="form-group">
                  <label for="email">Email: </label>
                  <input type="text" name="email" class="form-control" id="email" value="<?php echo $getemail; ?>" readonly>
                </div>
                </div>
                <div class="span4">
                <div class="form-group">
                  <label for="pass">Password: </label>
                  <input type="password" name="pass" class="form-control" id="pass" value="" placeholder="Enter your password" required >
                </div>
                <div class="form-group">
                  <label for="passnew1">New Password: </label>
                  <input type="password" name="passnew1" class="form-control" id="passnew1" value="" placeholder="Enter your password" required >
                </div>
                <div class="form-group">
                  <label for="passnew2">Enter New Password Again: </label>
                  <input type="password" name="passnew2" class="form-control" id="passnew2" value="" placeholder="Enter your password" required >
                </div>
                </div>
                </div>
              <br>
                <button type="submit" name="submit" class="btn btn-info btn-large btn-block">Submit <i class="icon-ok icon-white"></i></button>
                <?php echo "<div class='bg-danger'>$stat</div>";?>
            </form>
            <br>
            </div>
            <div class="span2"></div>
        </div>
      </div>

请帮助我...有什么建议可以解决吗?

哈哈我的坏..把那个

function test_input($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}

最重要的是……完成了……谢谢