Good day. I would like to use an ajax function to transfer data to my php page but i am using $_GET variable for verification purposes. When i put
$.ajax({
type: "POST",
url: "coordsave.php?username=<?php echo($_GET['username']);?>",
data: {x: pos_x, y: pos_y,}
}).done(function( msg ) {
alert( "Data Saved: " + msg );
});
}
and here is the php page that it sends data to
$x_coord=$_POST["x"];
$y_coord=$_POST["y"];
$id=$_GET["username"];
//Setup our Query
$sql = "UPDATE $coords SET x2='$x_coord', y2='$y_coord' WHERE user_uname='$id'";
//Execute our Query
if (mysql_query($sql)) {
echo "success $x_coord $y_coord ";
}
else {
die("Error updating Coords :".mysql_error());
}
Thanks for the help. I really need it. :)