You are here: Re: [PHP] Type of form element « PHP « IT news, forums, messages
Re: [PHP] Type of form element

Posted by Marcus Bointon on 10/31/05 18:33

On 31 Oct 2005, at 14:54, Chris Shiflett wrote:

> Hopefully it is also clear that your argument revolves around the
> idea that PHP would create $_POST['foo'] as NULL if the checkbox is
> not checked. This is wrong for two reasons:

No, no, that's not what I said - I wouldn't contemplate such
silliness! The thing I was wrong on is that PHP converts unset
parameters (as opposed to nonexistent ones which it obviously can't
do anything about) to an empty string, e.g. given ?a=&b=1, $_REQUEST
['a'] is "", not NULL. However, it still serves to underline my other
point that using isset without actually knowing that is a potentially
dangerous thing. Getting into the habit of using it for looking in
the likes of $_REQUEST means you're likely to use it other places
where you have no such guarantee, and you'll have a bug to track
down. Using array_key_exists means you will never be exposed to this
possibility, no matter where your data comes from.

Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
marcus@synchromedia.co.uk | http://www.synchromedia.co.uk

 

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

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