Passing additional data with ismap

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I'm trying to write a mapping app that the user can click on some nav
buttons (Up, Down, Lf, Rt, Zooom, etc) to pan/zoom the image but also
include 'ismap' such that where ever the user clicks on the image, it
will recenter on that spot (X,Y). I can get things working with either
the nav buttons or ismap but not both due to fact that I need to pass 3
additional name/value pairs (xc,yc,z_num) to the calling script. This
is what I'm trying:


//###########     geo_caller.php      #############//
//####    Original Image size 1800 X 1200    ######//

$base = 0.8;

if (isset($zoom)) {
$z_num += $zoom;
$z_fact = pow($base,$z_num);
} elseif (isset($horz)) {
$z_fact = pow($base,$z_num);
$xc += $horz*80*$z_fact;
} elseif (isset($vert)) {
$z_fact = pow($base,$z_num);
$yc += $vert*60*$z_fact;
} elseif (isset($input[0])) {
$z_fact = pow($base,$z_num);
$coords = explode(',', $input[0]);
$xc += (400-$coords[0])*$z_fact;
$yc += (300-$coords[1])*$z_fact;
} else {
$z_num = 0;
$z_fact = 1;
$xc = 900;
$yc = 600;

$scr_wdth = $z_fact*800;
$scr_ht   = $z_fact*600;
$scr_x    = $xc-($scr_wdth/2);
$scr_y    = $yc-($scr_ht/2);

print "<input type=hidden name=xc value=$xc>";
print "<input type=hidden name=yc value=$yc>";
print "<input type=hidden name=z_num value=$z_num>";

echo "<a href=\"geo_caller.php\">";
echo "<img
border=0 width=800 height=600 ismap></a>;\n";


I need to somehow pass/retain the current xc, yc, z_num variables but I
can't when using 'ismap'. I've found snippets of javascript where I can
extract the X,Y coordinates but it gets to complicated trying to mix
the two.

Any ideas?


Re: Passing additional data with ismap

Quoted text here. Click to load it


You seem to be trying to pass the extra data in hidden form variables,
but there's no <form> to contain them and no <input type="submit">
widget either. I don't think any browser will know what to do with

But since you are also passing some URL parameters to geo_plot.php, if
these variables are being picked up correctly why not add the missing 3
variables to this list?


Re: Passing additional data with ismap

geo_plot.php is the script that generates the image (map) on the fly.
The main or calling script (geo_caller.php), listed above, actually
calls itself. It recalculates some parms which get passed to the
geo_plot.php script which in turn recreates the image. Kind of
confussing. The hidden form variables were just where I last left
experimenting with it.



Re: Passing additional data with ismap

That makes it clearer. Append the 3 extra vars to the handler URI, plus
an empty dummy placeholder var for the image map co-ords:


The co-ords from the image map will appear at the end of the
QUERY_STRING, making it look like this:


You now get 'map' as a key in the $_GET[] array, with the co-ords
prefixed with '?' and delimited by ','. Split on '?', then ',', then
proceed as before. Your extra vars are also in $_GET[] of course.

Re: Passing additional data with ismap

Steve wrote:
Quoted text here. Click to load it

That works Perfect.

Thanks for your help.


Site Timeline