You are here: Re: 2 submision buttons & IE problem « All PHP « IT news, forums, messages
Re: 2 submision buttons & IE problem

Posted by Rik on 01/22/07 18:56

luigi7up wrote:
> Hi, I'm having a problem with submiting a form.
>
> My form has two submit buttons:
>
> <input name='task' value='refresh' type='image'
> src='images/osvjezi.jpg' />
> <input name='task' value='add' type='image' src='images/osvjezi.jpg'
> />
>
> When I submit data I get it from $_POST['task'] without problem in
> Firefox but in IE there is no way.
> I found one solution somewhere on the web:
>
>
> <input name= 'task[0]' value='refresh' type='image'
> src='images/osvjezi.jpg' />
> <input name= 'task[0]' value='add' type='image'
> src='images/osvjezi.jpg' />
>
> To get $task value I should do following: $_POST['task'][0].
>
> This solution worked fine for a while. Now it doesn't work again...
> If firefox for $_POST['task'][0] i get good value but in IE I don't.
>
> If I print_r$_POST['task'] in IE I get: [task] => Array ( [0] => 18 )
> while I should be getting
> [task] => Array ( [0] => refresh )
>
> I could always name the buttons diferently but that isn't solution in
> striving for...:)


As far as I know this is how submitting with images works:
<input name="something"> will send something.x and something.y to the
server. There _might_ be a 'pure' 'something', but as far as I know this is
optional/not strictly necessary, well I'm too laxy to read the
documentation, but at least it's not always sent, therefor unreliable.

In PHP, something.x and something.y will be transformed to something_x and
something_y to form valid keys for the POST array. These two values will
contain the coordinates clicked.

If you want another value then the clicked coordinates, you shouldn't use
type="image", but style an <input type=submit> or perhaps use a <button>

Grtz,
--
Rik Wasmus

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация