PDA

View Full Version : Input Image Post on Click



Templarian
July 21st, 2006, 11:11 PM
The bottom example works in Firefox but not in IE.

Example:

<form method="POST" action="?action=testing">
button1: <input type="image" name="btn" id="btn" value="VALUE 1" /><br />
button2: <input type="image" name="btn" id="btn" value="VALUE 2" /><br />
button3: <input type="image" name="btn" id="btn" value="VALUE 3" /><br />
button4: <input type="image" name="btn" id="btn" value="VALUE 4" /><br />
button5: <input type="image" name="btn" id="btn" value="VALUE 5" />
</form>
<?php
if($_GET['action'] == 'testing'){
print($_POST['btn']);
}
?> What I want to Happen:
Button 3 is pushed so that ($_POST['btn'] == "VALUE 3") = true
Question:
So this possible or not?

Working Example (well working in FF):
http://www.templarian.com/misc/kirupa/test.php?

Conclusion:
Not supported by IE. Given up and recoding system.

hl
July 22nd, 2006, 12:36 AM
Try writing "button" for the input type. I don't know, but I think that'll work.

redrum87
July 22nd, 2006, 01:44 AM
For it to be valid XHTML :nerd: , you can't have the same id on a page twice. That probably won't fix the problem because browsers are pretty forgiving about that. But I mention it because we're talking about Internet Explorer here.

Templarian
July 22nd, 2006, 02:36 AM
Works in IE when the type is submit... wierd. Anyway to get around this if not i'll just use some javascript work around (but i have to change a lot of code by hand and would like to do it this way).

Found nice work around in JS.