I notice as I'm trying to pass the value of cardnum, date and str to another page which is updatestaffshift page, and after echo the cardnum value, it appears to be a different value than the correct cardnum. However it only occur for cardnum begins with number 0. Numbers other than 0 the passing value is correct. I have included the output of my result. Please advice on what is wrong with this. Thank you.
function updatestaffshift(cardnum,date,str)
{
var xmlhttp;
if (str=="")
{
document.getElementById("txtHint").innerHTML="";
return;
}
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","updatedata/updatestaffshift.php?u="+str+"&cardnum"+cardnum+"&date="+date,true);
xmlhttp.send();
Echo card no
$sql=" SELECT * FROM staff_detail";
$query = mysqli_query($sql);
$int = 0;
while ($rr = mysqli_fetch_assoc($query)){
$cardnum[$int] = $rr['cardnum'];
echo "Correct Card No :" ; echo $cardnum[$int];
updatestaffshift.php - Echo passed value
echo 'Passed Value of Card No : '; echo $cardnum = $_GET['cardnum'];
Output of result
question from:
https://stackoverflow.com/questions/65904576/different-value-passed-for-cardnum-begins-with-0-in-ajax 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…