views:

171

answers:

1

I have one image submit button like this

     <input id="enter" name="enter" type="image" 
      value="Login"
       src="images/btn_login.jpg"/>

once i click on this image i got following values

    enter.x=39&enter.y=11

but i want to get enter=Login on submit

how to get enter value as login on submit?

Thanks

Some Quick browser tests

Chrome: Working
Safari: Working
Firefox: Working
IE: Not Working
Opera: Not working

Working means enter=login is passed. All browsers are at latest version at the time of writing

A: 

IE6 and IE7 definitely don't pass through the value of an image submit, so you can't use this method if you want your page to work in those browsers. However I'm surprised that you say the latest version of IE doesn't work, I thought it did

The only reliable fallback I've found is to overload the name attribute:

 <input id="enter" name="enter.login" type="image" 
  value="Login"
   src="images/btn_login.jpg"/>

Then, you have to iterate through all the form params and look for one whose name starts with 'enter'. Note that your input still needs to have a value attribute of some kind, otherwise browsers won't pass it through at all.

Alternatively you can use a normal submit button with a background image - tricky to get consistently styled, or a <button> - although that has even more issues in IE than an image submit :(

Gareth