Jump to content

Archived

This topic is now archived and is closed to further replies.

Neptunus Maris

Image Mapping with PHP...

Recommended Posts

Hey guys...

How do you do image mapping with php?  for example if I was doing an image map of a real map and a user clicked on a region on the map it would go to another page (show_region.php) and show its info. How could i wok that with php? or how could i bring up the links?

I know that to get the link you'd have to do this:

$query = "SELECT * FROM regions";
$result = mysql_query($query) or die(mysql_error());                  <----This stuff brings up the data info.
$region = mysql_fetch_array($result) or die(mysql_error());

//Now on the image mapping process i dont know how to do the link with the corresponding region data

//I know how to get the link of each region: <a href = 'show_region.php?regionID=$region[$regionID]'>$region['name']</a>
//Still dont know how to work it in.

I know what to do when the user clicks the link:

$regionID = $_GET['regionID']
$query = "SELECT * FROM regions WHERE regionID = '$regionID'";
$result = mysql_query($result) or die(mysql_error());
$region = mysql_fetch_array($result) or die(mysql_error());

// And then blabla from there to view the regions info.


So how can I properly put the links in on the image mapping process?

Thanks in advance,
Neptune

Share this post


Link to post
Share on other sites
http://www.htmlgoodies.com/tutorials/image_maps/index.php

read this ok.

Share this post


Link to post
Share on other sites
sorry the only one i use ok.


http://developer.yahoo.com/maps/rest/V1/mapImage.html

Share this post


Link to post
Share on other sites
can you exsplain the concept in your website what you want to do as my golden ball has brocken maybe i can help but i need to  know exackly what kind of website your creating to guide you correctly ok.

Share this post


Link to post
Share on other sites
exsplain on here then what you want to map to or from.

example if a user put there post code in a text box then the user is shown a map of were they live that one example ok.

this example can be done with phone numbers , post codes, area code, area,

Share this post


Link to post
Share on other sites
OK the here is what im talking about..

At a php page, map.php, i want a user to beable to click on the map(the picture) , on any region of the map. Then it will take them to a page called show_region.php to show all the regions info.  For an example: [url=http://romanlegion.com/garrison.php?RomanSession=aa4ca0771cb21a539aa0f540548513e5]http://romanlegion.com/garrison.php?RomanSession=aa4ca0771cb21a539aa0f540548513e5[/url]

But the trick is, is how i would use PHP/MySQL with the links...to regularly get the link from a piece of data from the MySQL database is.

I know that to get the link you'd have to do this:

$query = "SELECT * FROM regions";
$result = mysql_query($query) or die(mysql_error());                  <----This stuff brings up the data info.
$region = mysql_fetch_array($result) or die(mysql_error());

Then this as the link : <a href = 'show_region.php?regionID=$region[$regionID]'>$region['name']</a>

Where can I put that link that will correspond to an image sector on the map...(that will correspond to the id of what i want to get form the database)

And then once the user clicks the link and goes to the show_region.php:

$regionID = $_GET['regionID']
$query = "SELECT * FROM regions WHERE regionID = '$regionID'";
$result = mysql_query($result) or die(mysql_error());
$region = mysql_fetch_array($result) or die(mysql_error());

The code will look like that to start the retrival of info...like

<table>
  <tr>
  <td>$region['capital']</td>
  </tr>
And bla bla bla.

Once again im just trying to figure out how to make the links to be put in the image mapping correspond to the data.

Thanks
Neptune


Share this post


Link to post
Share on other sites
What i come up with


This is only a quick 2 sec html way but you can convert all the information from the database.

For example the link the image ect ect ect ok.

[code]
<DIV ALIGN=CENTER>

<MAP NAME="map1">
<AREA
   HREF="contacts.html" ALT="Contacts" TITLE="Contacts"
   SHAPE=RECT COORDS="6,116,97,184">
<AREA
   HREF="products.html" ALT="Products" TITLE="Products"
   SHAPE=CIRCLE COORDS="251,143,47">
<AREA
   HREF="new.html" ALT="New!" TITLE="New!"
   SHAPE=POLY COORDS="150,217, 190,257, 150,297,110,257">
</MAP>

<IMG SRC="testmap.gif"
   ALT="map of GH site" BORDER=0 WIDTH=300 HEIGHT=300
   USEMAP="#map1"><BR>

[ <A HREF="contacts.html" ALT="Contacts">Contacts</A> ]
[ <A HREF="products.html" ALT="Products">Products</A> ]
[ <A HREF="new.html"      ALT="New!">New!</A> ]
</DIV>
[/code]

Share this post


Link to post
Share on other sites
I think i hava a general idea now...maybe, but do you know where i can get a program or something that will get me the coordinates for my picture(map)?

Share this post


Link to post
Share on other sites
you need a free softwere to get the cords read this ok.

http://www.htmltutorials.ca/lesson20.htm

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.