Passing additional data with ismap 
July 17th, 2005, 10:47 AM
| | | Passing additional data with ismap
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 | 
July 17th, 2005, 10:47 AM
| | | Re: Passing additional data with ismap
[color=blue]
> I can get things working with either
> the nav buttons or ismap but not both due to fact that I need to pass[/color]
3[color=blue]
> additional name/value pairs (xc,yc,z_num) to the calling script.[/color]
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 | 
July 17th, 2005, 10:48 AM
| | | 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.
Thanks
-Matt | 
July 17th, 2005, 10:48 AM
| | | 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:
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 | 
July 17th, 2005, 10:49 AM
| | | Re: Passing additional data with ismap
Steve wrote:[color=blue]
> That makes it clearer. Append the 3 extra vars to the handler URI,[/color]
plus[color=blue]
> 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[/color]
That works Perfect.
Thanks for your help.
-Matt | | Thread Tools | Search this Thread | | | |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | | | | What is Bytes?
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 220,989 network members.
|