Imagemap and $_GET

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Shendemiar
Forum Contributor
Posts: 404
Joined: Thu Jan 08, 2004 8:28 am

Imagemap and $_GET

Post by Shendemiar »

Can i, and how, use $_get to receive the coordinates submittend my imagemap like http://www.kana.koira/blaah?123,345
Goowe
Forum Commoner
Posts: 94
Joined: Mon Mar 15, 2004 9:51 am
Location: Southeast Alaska

Post by Goowe »

Can you elaborate?

Do you mean that the image map is sectioned off and each part is a link and you want the link to go to the coordinates of that section? Or... do you want the sections to be made based upon the query string (retrieved using $_GET)?
Shendemiar
Forum Contributor
Posts: 404
Joined: Thu Jan 08, 2004 8:28 am

Post by Shendemiar »

I just wanted the coordinates.

I figured it out:

$cords = explode("," , $_SERVER['QUERY_STRING']);
echo "x=".$cords[0];
echo "y=".$cords[1];
Goowe
Forum Commoner
Posts: 94
Joined: Mon Mar 15, 2004 9:51 am
Location: Southeast Alaska

Post by Goowe »

Oooo very nice! I was making it much harder than it was.
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

A more simple solution is "page.php?x=50&y=36".

Then simply echo() the two $_GET variables.
Shendemiar
Forum Contributor
Posts: 404
Joined: Thu Jan 08, 2004 8:28 am

Post by Shendemiar »

Sami wrote:A more simple solution is "page.php?x=50&y=36".

Then simply echo() the two $_GET variables.
But how could i make the imagemap to output x=50&y=36 ?

It outputs ?50,36 by default
Goowe
Forum Commoner
Posts: 94
Joined: Mon Mar 15, 2004 9:51 am
Location: Southeast Alaska

Post by Goowe »

Your link would be something like...

page.php?x=50&y=36

In your code, you put something like...

echo "x=".$_GET['x']."<BR>\n";
echo "y=".$_GET['y']."<BR>\n";
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

Shendemiar wrote:
Sami wrote:A more simple solution is "page.php?x=50&y=36".

Then simply echo() the two $_GET variables.
But how could i make the imagemap to output x=50&y=36 ?

It outputs ?50,36 by default
Oh I see. I thought you where in control of setting up the GET variables. ;)

Indeed your way is best, as long as nothing else is submit within the GET method. :)
Shendemiar
Forum Contributor
Posts: 404
Joined: Thu Jan 08, 2004 8:28 am

Post by Shendemiar »

Indeed your way is best, as long as nothing else is submit within the GET method.
Indeed, but now i would like to submit something else too.

Is there an easy way to submit various amount of $_GET data and imagemap (format= ?123,234) data at the same time.

Or it wouldnt be difficult but combining that stuff with istantjumping dropdownmenus that point back to itself is too complicated for me.

I would like the page to maintains all the settings and the coordinates even when any of the setting is changed. Maybe i have to drop that and start from clean table after any option change.

NOUP! I got it

I use fake _GET item like cords=* at the last element of the url. Then i allways get cords=*?123,234 and $_GET['cords']=*?123,234

And thats easy to parse...
Post Reply