You are here: Re: -> Data processing in IExplorer failing / Firefox ok: why? <- « PHP Programming Language « IT news, forums, messages
Re: -> Data processing in IExplorer failing / Firefox ok: why? <-

Posted by Rik on 07/18/06 13:57

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация