Jump to content

Hyperlink Image to Form Field


vigiw

Recommended Posts

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
Share on other sites

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 County

Then the user clicks

Smith County

And suppose those are the only counties in the alert.  Could I make it so in the form field automatically it will say

Johnson, and Smith Counties.

Or something similar noting both counties, as above?

This is what confuses me most.

Thanks again!
Link to comment
Share on other sites

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 "&amp;country2=" . $_GET['country2'] ?>" ALT="County 1" COORDS="5,5,95,195">
<AREA HREF="map.php?county2=selected<?php if($_GET['country1']) echo "&amp;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>
<?php
if($_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
Share on other sites

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 as

hotspot 1, hotspot 2, hotspot 3

or something like that in the form field.

Thanks!
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.