tel 0845 230 2065email growth@uniqueaccountants.co.uk

Posting With input type=”image”

A handy reminder for anyone playing with html forms: Internet Explorer does not post values assigned to an input with type ‘image’. It ignores the value and simply posts the co-ordinates at which the image was clicked.

The most likely reason to post a value associated with an image input is probably if calling a specific function. In this case, the image is usually in place of a submit button so the fix is quite simple: put the name/value into a hidden element so the information is definitely posted when the form is submitted.

<input type="image" src="save.gif" value="Change" name="ChangeInfo">

Would become:

<input type="hidden" value="Change" name="ChangeInfo">
<input type="image" src="save.gif" name="SaveChanges">

Comments are closed.