By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,625 Members | 1,283 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,625 IT Pros & Developers. It's quick & easy.

Passing additional data with ismap

P: n/a
Greetings,

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:

<?php

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

$base = 0.8;
$input=array_keys($_GET);

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
src=\"geo_plot.php?SCR_WDTH=$scr_wdth&SCR_HT=$scr_ ht&SCR_X=$scr_x&SCR_Y=$scr_y\"
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?

-Matt

Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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.


Matt:

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
them.

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?

---
Steve

Jul 17 '05 #2

P: n/a
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.

Thanks

-Matt

Jul 17 '05 #3

P: n/a

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:

geo_caller.php?xc=$xc&yc=$yc&z_num=$z_num&map=

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

xc=900&yc=600&z_num=0&map=?371,113

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.
---
Steve

Jul 17 '05 #4

P: n/a

Steve wrote:
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:

geo_caller.php?xc=$xc&yc=$yc&z_num=$z_num&map=

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

xc=900&yc=600&z_num=0&map=?371,113

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.
---
Steve


That works Perfect.

Thanks for your help.

-Matt

Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.