Anyone have any ideas? this problem is driving me crazy.
Thanks in advance
-emrys
Anyone have any ideas? this problem is driving me crazy.
Thanks in advance
-emrys
it works in firefox because that browser will post or get the page to itself by default if there is nothing specified in the form's action.
as for it working when you use IE or opera, I can't say. I created a form with an image for the input and it worked fine for me in IE.
post the code for the form, maybe something else is causing the problem.
Okay i recreated the error using these lines:
<?php
if($_POST['submit'] == "Submit")
{
echo "It worked!";
}
else
{
?>
<form method="post" action="<?php $PHP_SELF ?>">
I am:<input type="text" name="name" size="20" value="">
<br>
<center>
<input type="image" src="images/submitbutton.jpg" name="submit" value="Submit">
</center>
</form>
<?php
}
?>
Again this works beautifully in Firefox, but not in Opera 6 or IE 6.
Also again i am conducting these tests on my local machine running apache, but i have uploaded it and tried it on a different machine with the same result.
The specific problem with it is when hitting the submit button it merely reloads the page (which was why i initially thought it was with the $php_self)
Hope that clarifies a few things
Thanks in advance
-emrys
Are you just hitting enter while focus is in the text input, or are you always using your mouse to click the submit button? In IE it won't send the submit button's info if you just hit enter in a input field if I'm not mistaken.
I just tried it and hitting enter and clicking on it give the same result.
Thanks
-emrys
Can someone please try and run the code and tell me what they get?
Is there a function to see any and all data being submitted via post? but that wouldnt make much sense because even isset() doesnt work (i guess that means its not even making it to the $_POST variable).
I took out the $php_self just to be sure and the form action works fine, it calls the new page, but the submit data doesnt go through. It does open an email when i change the action to a mailto:, however.
I cant for the life of me see whats wrong with it and its driving me nuts. I've checked a number of online tutorials for reference, but they all say the same thing. Any thoughts, suggestions, ideas?
Thanks in advance,
-emrys
I've simply used: <input type="image" src="button_submit.gif" border="0"> (minus the name and value) and it works fine.
You posted this again:
<form method="post" action="<?php $PHP_SELF ?>">
And my concern is this:
<?php $PHP_SELF ?>
This tells PHP to do nothing. Period.
You need <?=$PHP_SELF?> or <? echo $PHP_SELF?>. If using those you still see the action attribute blank, then you'll probably need to use $_SERVER['PHP_SELF'].
Give that a whirl and see what you get. Check the source code and copy the HTML output of the form action if its still not working.
I would have to say, I did try out the code you posted and I can not get it to work in IE. I would say the only thing is that IE doesn't support or use the tag <input type="image"... in the same manner as Firebird. Cause if you change it to a submit button everything works fine. I could be wrong, but that is all I could come up with. I even tried Astrotag's method, which I can't see how that would work, but it didn't work either. Sorry.
I would change your post method to get and just see what's really being passed.
You could try
if ( isset($_POST['submit_x']) ) {
## ...
}
if it's an image button (<input type="image" ... />)
First make sure the action="" has a value. If its blank, then you've got a problem.
Second, make sure the page submits and the script can get the values.
<input type="image" src="image.jpg"> is a very standard HTML tag. If IE isn't handling it, then you have a problem somewhere else (the beauty in IE is the problem isn't always where you expect it to be).
As tshafer mentioned, the problem may be with your PHP code that checks if the form was submitted.
rgermain>> Thanks for testing it out, at least now i know i'm not cursed
AstroTeg>> At first i though that the $PHP_SELF was the culprit, and i ended up checking out all variations of php_self and found that ie worked with them all even though the source said action="". i did get action to show something by using echo $_SERVER['PHP_SELF'] , but it doesnt seem to make a difference.
I tried changing the method to get. and this is what is happening:
in firefox:
/temp.php?iam=blah&submit.x=70&submit.y=16&submit=Submit
and in ie:
/temp.php?iam=blah&submit.x=70&submit.y=16
as we can see IE is not assigning a name and value to the submit button.
So now that we know the problem is there anyway to fix this?
Thanks for all your help
-emrys
Toss a hidden variable in there called submit and set the value to submit.
OKay, so, after further research i have come to the conclusion that Internet Explorer sucks. Yup you heard it here first.
Aparently ie doesnt allow a value to be submitted with an <input type="image"> tag. So to get around this vast oversight i simply added a hidden field with the proper name and value. Bam, problem solved.
Thanks for all your help. Hope this thread keeps some other poor shmuck from banging his head against a wall.
-emrys
(EDIT: thanks astroteg, you beat me to the punch
Just for referance sake, having:
action=""
is treated like having it as:
action="<?=$PHP_SELF?>"
That is in IE and Firebird/Fox anyway.
Now I am not saying that is the way it should be done and I have never created a page purposely that way, but I am just saying if you leave action empty the form just submits the page to itself.
I only know this cause I have forgot the = when writing it like
action=<?=$PHP_SELF?>
and the code worked fine. Just happened to notice one time that the action was empty. Fixed it immediatly.