|
Posted by Rik on 07/18/06 23:41
die.spam@hotmail.com wrote:
> Rik wrote:
>
>> Steve JORDI wrote:
>>> Hi,
>>> I have a strange behavior when using IExplorer over FireFox.
>>>
>>> There is an html form that asks for the name of a city and has
>>> a dedicated field for that with a submit button next to it.
>>>
>>> In IExplorer, if I hit return instead of clicking the button,
>>> the PHP query on MySQL fails when reaching the mysql_fetch_object
>>> function. It's ok if I click the button.
>>>
>>> FireFox always works in both cases.
>>>
>>> I suspect that IExplorer interprets the return as a carriage return
>>> and inserts a control character in the query, whereas FireFox
>>> interprets the return as a click on the submit button.
>>
>>
>> print_r($_POST); and you will probably see the difference.
>>
>> this line of code:
>> if( isset($_POST['submit'])){
>>
>> }
>> mysql_fetch_object($result);
>> Will give you the error in question: the query isn't run, but you
>> still try to get it's results.
>>
>> The problem is FF indeed emulates the click on the first submit
>> button it encounters (as it should, allthough I'm not really sure),
>> while MSIE posts it without the 'submit' present.
>>
>> Solution:
>>
>> HTML:
>> <input type="hidden" name="submitted" value="1" />
>>
>> PHP
>> if( isset($_POST['submitted'])){
>> //and ALL your database retrieval code here, not just the query
>> }
>>
>> Grtz,
>> --
>> Rik Wasmus
>
> Yes thats correct, just to clarrify, when you hit enter in ie, it
> doesn't post submit, when you click the submit button it does. with ff
> it posts submit whether you click or hit enter. I believe this may be
> fixed in ie 6+
Yup, found that out the hard way: items with a delete button next to it, and
a submit button at the bottom to submit changes. Entering in FF would cause
a virtual click on the nearest submit button. Imagine what happened...
That's when I was glad the client had insisted there should be an 'are you
sure?' form in between hitting delete and actually deleting :-)
Grtz,
--
Rik Wasmus
Navigation:
[Reply to this message]
|