Passing additional data with ismap

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • mpm3@yahoo.com

    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_ke ys($_GET);

    if (isset($zoom)) {
    $z_num += $zoom;
    $z_fact = pow($base,$z_nu m);
    } elseif (isset($horz)) {
    $z_fact = pow($base,$z_nu m);
    $xc += $horz*80*$z_fac t;
    } elseif (isset($vert)) {
    $z_fact = pow($base,$z_nu m);
    $yc += $vert*60*$z_fac t;
    } elseif (isset($input[0])) {
    $z_fact = pow($base,$z_nu m);
    $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_call er.php\">";
    echo "<img
    src=\"geo_plot. php?SCR_WDTH=$s cr_wdth&SCR_HT= $scr_ht&SCR_X=$ scr_x&SCR_Y=$sc r_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

  • Steve

    #2
    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

    Comment

    • mpm3@yahoo.com

      #3
      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

      Comment

      • Steve

        #4
        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

        Comment

        • mpm3@yahoo.com

          #5
          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

          Comment

          Working...