Making an image trigger an action

images php coding issues or problems here.

Moderators: egami, macek, gesf

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

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


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

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>

that should get you in the right direction.

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

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