|
Posted by Steve JORDI on 12/07/06 14:36
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
------------------------------------------------
[Back to original message]
|