Making an image trigger an action

images php coding issues or problems here.

Moderators: macek, egami, gesf

Post Reply
User avatar
egami
php-forum GURU
php-forum GURU
Posts: 2196
Joined: Wed Oct 06, 2010 11:19 am
Location: Happy Valley, UT

Re: Making an image trigger an action

Post by egami » Tue May 31, 2011 10:08 am

in order to make an image be an action, it has to be either a link, or a form.

a simple javascript can make it a post form, or you just create it as a link..


ie..

<a href="thispage.php?lang=en"><img src="english.jpg"></a>


or..
a form..

<form name="english" method="post" action="thispage.php">
<input type="hidden" name="lang" value="en">
<a href="javascript:document.english.submit();"><img src="english.jpg"></a>
</form>


that should get you in the right direction.

User avatar
gandahar
New php-forum User
New php-forum User
Posts: 112
Joined: Tue Mar 15, 2011 4:05 am

Re: Making an image trigger an action

Post by gandahar » Thu Jun 09, 2011 5:49 am

easiest javascript solution

no need forms, no need to create a javascript function, no need a href link....

Code: Select all

<img src="img.jpg" onclick="document.location.href='mapage.php?lang=fr';">

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests