passed variables from form, using multiple image sumbit IE
Posted: Sun Feb 11, 2007 8:37 am
feyd | Please use
Unfortunately it's very difficult because of strange IE behavior.
First of I tried to add input type image for both buttons passing different values:[/syntax]
mozilla works fine passing following:
edit_x => ""
edit_y => ""
edit => "1"
The problem is that IE will not pass name and value, but just position adding .xy (_xy in php) where you clicked the image button:
edit_x => "10"
edit_y => "10"
After some time i give up and tried another solotion with button element using following code:
Guess what, all is fine in mozzila passing following:
edit => "1"
but variables from passed by IE are wrong, it pass the "innerHTML" between <button></button>tag, and what more it passed both buttons:
edit => "<img src=".." alt="edit" />"
delete => "<img src=".." alt="delete" />"
I don't want to discuss if IE is working good or right etc., i readed many topics on that, i would like to discuss if there is a solution for this problem. Doees anybody have idea how to get over this ?
Thanks in advanced
Sargus
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hello to all,
sorry for long post please be patient I can't get over one little problem, i do have some output list of items from database and i want to add two image submiting form for each item, let's say for edit or delete. It should pass actual item id and action what to do (edit or delete ).
For accessibilty and security reasons , this must be accomplished without css or JavaScript. I can't neither use the GET method, it must be passed by POST. It must be accesible with/without enabled css and pictures.
I would like to avoid doing special form for every item like that.
[syntax="html"]
item id 1
<form action=".." method="post">
<input type="hidden" name="id" value="1">
<input type="hidden" name="action" value="edit">
</form>
<form action=".." method="post">
<input type="hidden" name="id" value="1">
<input type="hidden" name="delete" value="edit">
</form>
item id 2
and so on .......
First of I tried to add input type image for both buttons passing different values:
Code: Select all
<form action=".." method="post">
item id 1
<input type="image" name="edit" value="1" alt="edit " src="..">
<input type="image" name="delete" value="1" alt="delete" src="..">
item id 2
<input type="image" name="edit" value="2" alt="edit " src="..">
<input type="image" name="delete" value="2" alt="delete" src="..">
</form>
Code: Select all
if (isset($_POST["edit"]){
$action="edit";
$id=$_POST["edit"];
} elseif (isset($_POST["delete"]){
$action="delete";
$id=$_POST["delete"];
}edit_x => ""
edit_y => ""
edit => "1"
The problem is that IE will not pass name and value, but just position adding .xy (_xy in php) where you clicked the image button:
edit_x => "10"
edit_y => "10"
After some time i give up and tried another solotion with button element using following code:
Code: Select all
<form action=".." method="post">
item id 1
<button type="submit" value="1" name="edit"><img src=".." alt="edit" /></button>
<button type="submit" value="1" name="delete"><img src=".." alt="delete" /></button>
item id 2
<button type="submit" value="2" name="edit"><img src=".." alt="edit" /></button>
<button type="submit" value="2" name="delete"><img src=".." alt="delete" /></button>
</form>
edit => "1"
but variables from passed by IE are wrong, it pass the "innerHTML" between <button></button>tag, and what more it passed both buttons:
edit => "<img src=".." alt="edit" />"
delete => "<img src=".." alt="delete" />"
I don't want to discuss if IE is working good or right etc., i readed many topics on that, i would like to discuss if there is a solution for this problem. Doees anybody have idea how to get over this ?
Thanks in advanced
Sargus
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
[quote="[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1"][b]1.[/b] Select the correct board for your query. Take some time to read the guidelines in the sticky topic.[/quote]