You are here: Re: -> Image submit buttons OK in Firefox, not in IExplorer. Why? <- « PHP Programming Language « IT news, forums, messages
Re: -> Image submit buttons OK in Firefox, not in IExplorer. Why? <-

Posted by Jerry Stuckle on 12/07/06 15:59

Steve JORDI wrote:
> Just a question using images as submit buttons and PHP4.4.4.
> It seems that my code correctly works in FireFox but not in IExplorer.
>
> For example, I have a FORM with 2 buttons called "search" and "save".
> In a second file, the one mentioned in the "action" parameter,
> I test which button has been clicked in order to decide which action
> to take.
>
> IExplorer doesn't get anything, FireFox correctly works.
>
> Example:
>
> file main.php
> =============
> <form id="myform" name="myform" method="post" action="process.php">
> ...
> <INPUT name="search" type="image" value="search"
> src="images/search.gif" alt="search" />
> <INPUT name="save" type="image" value="save"
> src="images/save.gif" alt="save" />
> </form>
>
> file process.php
> ================
> echo "***".$_POST."<BR>" ; // Always returns an empty Array
> if( isset($_POST['search'])) {
> header("Location: ./search.php") ;
> }
> else
> if( isset($_POST['save'])) {
> header( "Location: ./save.php" ) ;
> }
> else {
> echo "Houston, we've got a problem<br />" ;
> }
>
>
> Firefox correctly sees the variables "search" and "save".
> Internet explorer always "contacts Houston".
>
> I have tried to name my two INPUT to "submit"
>
> <INPUT name="submit" type="image" value="search"
> src="images/search.gif" alt="search" />
> <INPUT name="submit" type="image" value="save"
> src="images/save.gif" alt="save" />
>
> and then check the value of the submit, using
>
> if( $_POST['submit'] == 'search' )...
>
> Doesn't work in IExplorer.
>
>
> Then I checked to see whether I have the search_x or save_x variable
> that are supposedly automatically created, but they don't exist in
> neither browser.
> That's why my echo $_POST returns nothing.
>
> What's wrong here?
> Any help would be greatly appreciated.
>
> Thanks in advance.
>
>
>
>
> Sincerely,
> Steve JORDI
>
> (Remove the K_I_L_LSPAM from my email address)
> ------------------------------------------------
> 1197 Prangins Email: stevejordiK_I_L_LSPAM@hotmail.com
> Switzerland WWW: www.sjordi.com
> ------------------------------------------------
> Volcanoes at www.sjordi.com/volcanoes
> MovieDB at www.sjmoviedb.com
> ------------------------------------------------

Nothing's wrong with your code. IE's broke. For image buttons it only
sends the x and y coordinates of the selection, not the value. IIRC,
the correct values are $_POST['submit.x'] and $_POST['submit.y'] (which
Firefox also correctly sends).


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

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

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