471,598 Members | 1,058 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,598 software developers and data experts.

Problem with IE(6.0)

121 100+
Hello,

I have one problem regarding <input> tag in forms
i am using input type=image and should be work as a submit buttom
in Mozilla firefox its working very fine, after submit the image button i can
able to get the post values of the text box.

whereas in IE(6.0) if i open same code in the IE i was not able to get the post values of text box. i.e. the image submit button is not working properly if a changed from type=image to type=submit it will work fine(i.e. i can get the post values).

so, this is my problem can any one get solution for this
Oct 24 '07 #1
4 1256
Atli
5,058 Expert 4TB
Hi.

I've used this method in IE6 without problems.
Could you show us your form and the code you use to read the data?
Oct 24 '07 #2
sbettadpur
121 100+
Hi.

I've used this method in IE6 without problems.
Could you show us your form and the code you use to read the data?

hi,

herewith i am sending my code..........
################################################## ##########
[html]<html>
<head>
<title>button</title>
</head>
<body>

<form name='f1' action='button.php' method='post'>
Firstname<input type='text' name='t1'>
Lastname <input type='text' name='t2'>
<!-- <input type='submit' name='sub' src='forward.gif' value='Fw'> -->

<input type='image' name='sub' src='forward.gif' value='Fw'>


</form>

<?php

$fname = $_POST['t1'];
$lname = $_POST['t2'];
$but = $_POST['sub'];

if(isset($but) or ($but == "sub") ) {

echo $fname;
echo $lname;
echo $but;
}

?>
</body>
</html>[/html]
################################################## ###########

The above code is working fine in Mozilla firefox whereas in IE it's working only when the submit button type='submit' but not in type='image'
Oct 25 '07 #3
Atli
5,058 Expert 4TB
Ok.. I see.

I've done a little testing and it appears that when an image is used to submit a form you get _x and _y values for the image, and a value for the image itself if the value is set. If it is not, no value for the image itself is sent.

IE6 does not include the value for the image, even if it is specified so you PHP code was ignoring the entire thing when it didn't receive a value for the image.

I tried this code on the data sent by your form:
Expand|Select|Wrap|Line Numbers
  1. echo "<pre>";
  2. print_r($_POST);
  3. echo "</pre>";
  4.  
And in IE6 I got these results:
Expand|Select|Wrap|Line Numbers
  1. Array
  2. (
  3.     [t1] => asdf
  4.     [t2] => asdf
  5.     [sub_x] => 17
  6.     [sub_y] => 72
  7. )
  8.  
In Firefox I got these results:
Expand|Select|Wrap|Line Numbers
  1. Array
  2. (
  3.     [t1] => asdf
  4.     [t2] => asdf
  5.     [sub_x] => 85
  6.     [sub_y] => 52
  7.     [sub] => Fw
  8. )
  9.  
Note that the sub_x and sub_y values changed every time I submitted, even tho the code remained the same, in both browsers. Have no idea why.

So all you need to do is modify your code to check the sub_x or sub_y values instead of the sub element and it should work fine.
Oct 25 '07 #4
sbettadpur
121 100+
Hello,

Thank you very much, your idea is helped me a lot and also i learnt new thing that if we gave submit button type=image we have to check for the x and y coordinates,

thanks
Oct 29 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

6 posts views Thread by B McDonald | last post: by
6 posts views Thread by SeaPlusPlus | last post: by
5 posts views Thread by Chris Beall | last post: by
8 posts views Thread by Bob Skutnick | last post: by
5 posts views Thread by Stephen | last post: by
5 posts views Thread by Segfahlt | last post: by
4 posts views Thread by Eric Lindsay | last post: by
12 posts views Thread by garyusenet | last post: by
2 posts views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by Anwar ali | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.