The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.
I'm pretty sure web browsers let you do this, but not really sure how to make PHP aware that they exist.
What I'm after is a simple script that will tell me the coordinates of the image map that the user selected.
xHTML:
ismap="ismap" />The ismap="ismap" attribute makes the browser append the x and y coordinates to the HREF URL as a query string, such as: map.php?125,467, with the x coordinate being first and the y coordinate being second. The PHP script can read this through its $_SERVER['QUERY_STRING'] superglobal
PHP:
$coords = explode(",",$_SERVER['QUERY_STRING']); # Split coordinates.
$x = trim($coords[0]); # Assign $x the x coordinate.
$y = trim($coords[1]); # Assign $y the y coordinate.
?>
I'm sure that it was built into HTML image maps, but was never sure how it worked, nor if its part of xHTML.
Its been a while since I've done anything major with JavaScript too. Do you mean have JS take note of the coords clicked and then append it to the URL link as a query string?
I'm pretty sure web browsers let you do this, but not really sure how to make PHP aware that they exist.
What I'm after is a simple script that will tell me the coordinates of the image map that the user selected.