Neptunus Maris Posted October 18, 2006 Share Posted October 18, 2006 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 Quote Link to comment Share on other sites More sharing options...
Neptunus Maris Posted October 18, 2006 Author Share Posted October 18, 2006 Does anybody even know how to image map? Quote Link to comment Share on other sites More sharing options...
redarrow Posted October 18, 2006 Share Posted October 18, 2006 http://www.htmlgoodies.com/tutorials/image_maps/index.phpread this ok. Quote Link to comment Share on other sites More sharing options...
Neptunus Maris Posted October 19, 2006 Author Share Posted October 19, 2006 That just tells you how to do it....I want to know how to mix php into it, like in the examples above. Quote Link to comment Share on other sites More sharing options...
redarrow Posted October 19, 2006 Share Posted October 19, 2006 sorry the only one i use ok.http://developer.yahoo.com/maps/rest/V1/mapImage.html Quote Link to comment Share on other sites More sharing options...
Neptunus Maris Posted October 19, 2006 Author Share Posted October 19, 2006 How so does this work redarrow...is a way I can contact you? Quote Link to comment Share on other sites More sharing options...
redarrow Posted October 19, 2006 Share Posted October 19, 2006 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. Quote Link to comment Share on other sites More sharing options...
Neptunus Maris Posted October 19, 2006 Author Share Posted October 19, 2006 Yes I can explain it better...I'd rather contact you live instead of on the forums Quote Link to comment Share on other sites More sharing options...
redarrow Posted October 19, 2006 Share Posted October 19, 2006 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, Quote Link to comment Share on other sites More sharing options...
Neptunus Maris Posted October 19, 2006 Author Share Posted October 19, 2006 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.ThanksNeptune Quote Link to comment Share on other sites More sharing options...
redarrow Posted October 19, 2006 Share Posted October 19, 2006 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] Quote Link to comment Share on other sites More sharing options...
Neptunus Maris Posted October 19, 2006 Author Share Posted October 19, 2006 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)? Quote Link to comment Share on other sites More sharing options...
redarrow Posted October 19, 2006 Share Posted October 19, 2006 you need a free softwere to get the cords read this ok.http://www.htmltutorials.ca/lesson20.htm Quote Link to comment Share on other sites More sharing options...
Neptunus Maris Posted October 19, 2006 Author Share Posted October 19, 2006 Thank you red>>>--->. ;D Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.