PDA

View Full Version : PHP functions on Image Maps



bigcougar
22 Sep 2010, 10:47 PM
OK. I am a complete newbie with PHP, but I know databases, Visual Basic and SQL.

What I am trying to accomplish is populate a drop down menu from a table on my server based on a image map hot spot selection.

Currently my image maps are linked to pages by the href="Page.html" parameter.


<area shape="poly" coords="181,186,158,181,147,167,171,172,175" href="M_BC.html" target="_self" alt="British Columbia">

How can I attach a function to a hot spot?

I would think, every hot spot will have its own variable, which will help me filter my table and load the results in the drop down list.

If you have anything similar coding on your pages, an example will be great!

is_numeric
24 Sep 2010, 09:52 AM
If your image maps are directing to the same page but you want to identify whats clicked you could use a query string appended to the href value.

notice I have changed the page to a PHP extension. (M_BC.php) And notice the ?id=map1 after the page is defined.


<area shape="poly" coords="181,186,158,181,147,167,171,172,175" href="M_BC.php?id=map1" target="_self" alt="British Columbia">

What you can do here is on the M_BC.php page add...


$id = $_GET['id'];

This catches the value from the id key value which in the example above would be map1

just use a condition to test the $id variable contents then construct your dropdown based on that result