Jump to content


Photo

Image Mapping with PHP...


  • Please log in to reply
13 replies to this topic

#1 Neptunus Maris

Neptunus Maris
  • Members
  • PipPipPip
  • Advanced Member
  • 192 posts

Posted 18 October 2006 - 07:48 PM

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

#2 Neptunus Maris

Neptunus Maris
  • Members
  • PipPipPip
  • Advanced Member
  • 192 posts

Posted 18 October 2006 - 11:42 PM

Does anybody even know how to image map?

#3 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 18 October 2006 - 11:47 PM

http://www.htmlgoodi..._maps/index.php

read this ok.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#4 Neptunus Maris

Neptunus Maris
  • Members
  • PipPipPip
  • Advanced Member
  • 192 posts

Posted 19 October 2006 - 12:52 AM

That just tells you how to do it....I want to know how to mix php into it, like in the examples above.


#5 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 19 October 2006 - 12:59 AM

sorry the only one i use ok.


http://developer.yah...1/mapImage.html
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#6 Neptunus Maris

Neptunus Maris
  • Members
  • PipPipPip
  • Advanced Member
  • 192 posts

Posted 19 October 2006 - 01:06 AM

How so does this work redarrow...is a way I can contact you?

#7 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 19 October 2006 - 01:36 AM

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.


Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#8 Neptunus Maris

Neptunus Maris
  • Members
  • PipPipPip
  • Advanced Member
  • 192 posts

Posted 19 October 2006 - 01:52 AM

Yes I can explain it better...I'd rather contact you live instead of on the forums

#9 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 19 October 2006 - 02:09 AM

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,
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#10 Neptunus Maris

Neptunus Maris
  • Members
  • PipPipPip
  • Advanced Member
  • 192 posts

Posted 19 October 2006 - 02:24 AM

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: http://romanlegion.c...aa0f540548513e5

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




#11 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 19 October 2006 - 02:33 AM

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.

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

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#12 Neptunus Maris

Neptunus Maris
  • Members
  • PipPipPip
  • Advanced Member
  • 192 posts

Posted 19 October 2006 - 02:53 AM

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)?



#13 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 19 October 2006 - 02:58 AM

you need a free softwere to get the cords read this ok.

http://www.htmltutor...ca/lesson20.htm
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#14 Neptunus Maris

Neptunus Maris
  • Members
  • PipPipPip
  • Advanced Member
  • 192 posts

Posted 19 October 2006 - 03:06 AM

Thank you red>>>--->. ;D




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users