vigiw Posted November 27, 2006 Share Posted November 27, 2006 Hello, I would like to know if it would be possible to have an image with hyperlink hotspots on different parts of it (to different destinations).. and these hotspots would be used to enter in data into a form field on that page. For example: There is a map of a state. There is a north and a south hotspot. If I click a certain area of the image and it happens to be north (State), could there be a text form field that would have data automatically entered into it on-click? Like, when I click this area all of a sudden in this form field it says "Northern Ohio"? (if Ohio were to be this state) This would really come in handy on my website.. any help appreciated.Thanks in advance!! ;D Link to comment https://forums.phpfreaks.com/topic/28585-hyperlink-image-to-form-field/ Share on other sites More sharing options...
Hypnos Posted November 27, 2006 Share Posted November 27, 2006 That's something that's built in to HTML.http://www.htmlhelp.com/reference/html40/special/map.htmlYou can put javascript functions in the link areas to change values, like you said. Link to comment https://forums.phpfreaks.com/topic/28585-hyperlink-image-to-form-field/#findComment-130807 Share on other sites More sharing options...
vigiw Posted November 27, 2006 Author Share Posted November 27, 2006 Ok thank you..Do you know how I can make a link in the image to enter data into the form field.This is what I really want to do. I will have a map of a local area, for one to issue a weather alert. The forecaster will click on different areas, which are seperated by county in hotspots. How do I make it so the user clicks:Johnson CountyThen the user clicksSmith CountyAnd suppose those are the only counties in the alert. Could I make it so in the form field automatically it will sayJohnson, and Smith Counties.Or something similar noting both counties, as above?This is what confuses me most.Thanks again! Link to comment https://forums.phpfreaks.com/topic/28585-hyperlink-image-to-form-field/#findComment-130809 Share on other sites More sharing options...
Hypnos Posted November 27, 2006 Share Posted November 27, 2006 Well, even though I said Javascript, you can do this with PHP too. You will just be loading a new page each time you click.[code]<MAP NAME=mymap><AREA HREF="map.php?county1=selected<?php if($_GET['country2']) echo "&country2=" . $_GET['country2'] ?>" ALT="County 1" COORDS="5,5,95,195"><AREA HREF="map.php?county2=selected<?php if($_GET['country1']) echo "&country1=" . $_GET['country2'] ?>" ALT="County 2" COORDS="105,5,195,195"></MAP><IMG SRC="sitemap.gif" ALT="Site map" USEMAP="#mymap" WIDTH=300 HEIGHT=200><?phpif($_GET['country1'] == "selected") echo "Country 1 is selected";if($_GET['country2'] == "selected") echo "Country 2 is selected";?>[/code]There's probably a more efficient way to code it, but I hope you at least get the idea. Link to comment https://forums.phpfreaks.com/topic/28585-hyperlink-image-to-form-field/#findComment-130815 Share on other sites More sharing options...
vigiw Posted November 27, 2006 Author Share Posted November 27, 2006 To be honest, I really have no clue how to get it over to the form.I'm not looking to link over to new page, I want some sort of "function" if you will from the clicking of an image hotspot that will enter data into the same page's form field.This page will be PHP and the data will be sent to a MySQL database.The PHP form page and database are OK to write, however, I'm not sure how to do this.How do I make it so in the same page when I click a certain area in the image, it will be entered into a certain form field--and can I do this with multiple hotspots so it appears ashotspot 1, hotspot 2, hotspot 3or something like that in the form field.Thanks! Link to comment https://forums.phpfreaks.com/topic/28585-hyperlink-image-to-form-field/#findComment-130818 Share on other sites More sharing options...
Hypnos Posted November 27, 2006 Share Posted November 27, 2006 That would have to be Javascript. Unless you used PHP to set the default values of the forms, on the next page. Link to comment https://forums.phpfreaks.com/topic/28585-hyperlink-image-to-form-field/#findComment-130822 Share on other sites More sharing options...
vigiw Posted November 27, 2006 Author Share Posted November 27, 2006 Thanks, but I don't understand how to make this work.Does anyone else know how this can work?Thanks! Link to comment https://forums.phpfreaks.com/topic/28585-hyperlink-image-to-form-field/#findComment-131086 Share on other sites More sharing options...
vigiw Posted November 27, 2006 Author Share Posted November 27, 2006 *bump*I'm still trying to do this.. please help out.. thanks! Link to comment https://forums.phpfreaks.com/topic/28585-hyperlink-image-to-form-field/#findComment-131198 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.