Problem: I have a javascript onClick that runs a .php file behind the scenes using ajax xmlhttp.open. My php file doesn't see the values stored in the URL where the onClick link exists.
Question: How do I send URL values so my .php file can update mysql database with those values?
Code:
My url looks like: index.php?id=1&test=hello
My javascript:
<script type="text/javascript">
function loadXMLDoc()
{
var xmlhttp;
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)
{
}
}
xmlhttp.open("GET","bar_next.php",false);
xmlhttp.send();
}
</script>
My bar_next.php File
<?php
mysql_query("UPDATE members SET visited = CONCAT($_GET['id'],visited)
WHERE username = '$_COOKIE[user]'");
?>