Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IE sends img-Tag instead of submit-button-value

Status
Not open for further replies.

buraje1

Technical User
Mar 13, 2005
7
DE
Hi,

I have a problem that seems to be small to me,
because it has been solved before, namely by those
who made phpmyadmin. Unfortunately I don't know what I
did differently, actually I took a part of their html-code
and modified it.

There are three submit-buttons that have been placed
with button-tags with img-tags inside.

Clicking on one of these buttons has different effects
(Delete, Edit, Export) to some database entries,
which can be marked with checkboxes.

I'm trying to do exactly the same ("html-form"-wise,
of course my DB-queries are different,
otherwise I could use phpmyadmin instead).

I took the buttons-tags of phpmyadmin and modified
them the way I needed:

Code:
<button class="mult_submit" type="submit" name="submit_mult" value="approve" title="Approve">
<img src="/images/approve.png" title="Approve" alt="Approve" width="16" height="16" align="middle" />
</button>

Appart from the texts and the img-src it's 1:1 from phpmyadmin
(and that works also in IE!)

In Firefox my code works perfectly, too,
when I submit with one of the buttons,
the value-Attribute of the button-tag
is being sent:
Code:
.../index.php?chkbx0=1122482183&[aqua]submit_mult[/aqua]=[navy]approve[/navy]
In PHP:
Code:
($_REQEST['submit_mult'] == "approve") is TRUE
when I click the approve-button that I exemplified here.
The same goes for the other buttons and their values.

In IE6 instead the http-request contains
all(!) img-tags
from inside the buttons as values of three different
submit_mult - variables,
instead of the value specified in the button-tag.

A "cleaned" version of what I find
in the address bar of IE:
(I replaced the ASCII-Hex-Codes by their characters
and put spaces in between for readability)

Code:
.../index.php? chkbx0=1122482183 & [aqua]submit_mult[/aqua]=[navy]<IMG + title=Approve + height=16 + alt=Approve + src="/images/approve.png" + width=16 + align=middle>[/navy]
[aqua]submit_mult[/aqua]=[navy]<IMG + title=Delete + height=16 + alt=Delete + src="/images/delete.png" + width=16 + align=middle>[/navy]
...

How can I get IE to send the value of those buttons
that I specified in the value-attribute?

Cheers,
Steven

P.S. I read FAQ, I made a keyword search, I googled around
and I validated the html code, didn't find a solution.
Especially, it is NOT
Code:
<button value="blabla> img-tag here </button>
because I left some quote open, or so. ;-)
 
Maybe let me put it in shorter words again:
I have multiple buttons that are images for one single form.

IE sends the img-tag I used (which is surrounded by the button tag) instead of the value of the button.

Has anybody experienced that before?

For code examples see the longer version above.
 
Yes, sure, I tried that.
Code:
<input type="image" src="/images/approve.png" name="submit_mult_approve" value="approve" alt="Approve" width="16" height="16" align="middle" />

I gave the three image - submits three different names,
so only one of them would be set.
Seem to work, but the mouse coordinates (I guess)
are being sent along with it in Firefox.
Code:
.../index.php?submit_mult_approve.x=2&submit_mult_approve.y=2&submit_mult_approve=approve

Well, I could handle that in PHP,
but in IE instead ONLY the mouse coordinates
are being sent, without the value:
Code:
.../index.php?submit_mult_approve.x=7&submit_mult_approve.y=12

But actually that might be enough:
Probably I can use the variable name
and php: isset
to find out which button had been clicked.

Some kind of a hack, though, but I'll give it a try.

Thanks!
 
For whoever might be interested in that:
Yes, it does work.
submit_mult_approve.x and submit_mult_approve.y
become available as
Code:
isset($_REQUEST['submit_mult_approve_x'])
(and the same with "y") in PHP.

So I can find out via the existance of these variables,
which button had been clicked and so I don't need the buttons
value any more.

Still a hack.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top