我正在通过fprs
URL 传递一个变量,但我似乎无法通过提交事件。$userID
当我点击提交按钮时,来自 URL 的变量超出范围。如何成功将此变量传递给我的查询?如您所见,我从 URL 获取 fprs,将其传输到$userID
,然后当我提交时,$userID 变为空。
$userID ="";
$usID="";
if(isset($_GET['fprs'])){
$usID = substr($_GET['fprs'], 8);
}
$userID = intval($usID);
if(isset($_POST['btnChange'])){
if($Validate == true){
$link = mysqli_connect($servername,$username,$password,$database);
var_dump($userID);
$updatePassStr= "Update User set Pass='$hashPass' WHERE UserID='$userID'";
if($update = mysqli_query($link, $updatePassStr)){
echo "good";
}
else{
$Error = "Some error occured with the database, please wait a little and try again.";
}
}