Click to See Complete Forum and Search --> : Html forms and posted variables that work in Firefox but not ie.


ooagentbender
11-20-2005, 05:47 AM
For the life of me I don't understand why this code works in Firefox but the value does not get passed in IE.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
<title>test</title>
<?
$test = $_POST["test"];
echo "Adf";
echo $test;
?>
<form method=POST action="test.php">
<input type="image" value="sdfg" src="pictures/HibOrWh_thumb.jpg" width="20" height="20" border="0" alt="test" name ="test"> </form>
</head> <body>
<br>
</body>
</html>

thanks all

bwkaz
11-20-2005, 02:48 PM
Um? I didn't know you even could POST an image. I doubt it's supported by many browsers anyway, though I don't know for sure.

What are you trying to accomplish? Should you maybe be using a file upload field instead?

Edit: Also, your HTML page is invalid. You can't have a form inside your <head> element, forms have to be inside the <body> element.

ooagentbender
11-20-2005, 03:30 PM
This is just an example of something im trying to accomplish, im sorry for not explaining my purpose in the first place. Im trying to have a button that is a picture that POSTs a value to another php page without having a text field. It works in Firefox but not in IE. Nothing is posted in IE but in the case of the above code the value="sdfg" gets posted and printed out when I click the button.

thanks

thaddaeus
11-20-2005, 04:28 PM
Ok here it is officially works, in both ie and ff
really just move the data you need to post with a hidden field rather than than in the image itself



<form method="post" action="test.php">
<input type="hidden" id="test" value="sdf" name="test">
<input type="image" src="<your image here>" width="50" height="50">
</form>

ooagentbender
11-20-2005, 04:45 PM
Thats awesome but it still renders as a button, I was hoping to have just the image present instead of that gray bordered monstrosity. Any suggestions?

thanks

NEVERMIND: I just used a border argument.

thanks all for your help problem solved.

je_fro
11-20-2005, 05:10 PM
Just detect their browser agent and tell IE users they must upgrade to Firefox.
:D

serz
11-20-2005, 05:35 PM
Just detect their browser agent and tell IE users they must upgrade to Firefox.
:D
haha I've done that script once :)

ooagentbender
11-21-2005, 06:19 PM
On another note, for some reason IE renders the forms down the page a bit you can see the example if you view this page in IE and Firefox.


http://168.105.125.20/Kapua/item.php


thanks

all