Reply to Re: isset

Your name:

Reply:


Posted by M. Sokolewicz on 09/29/29 11:08

D_c wrote:
> I often use this type of construct
>
> $cmd = $_POST['cmd'];
> if ($cmd == null) { // do default
>
> but this throws a notice if the ['cmd'] index is not defined. ugly.
> using
>
> if (isset($_POST['cmd'] ) {
> $cmd = $_POST['cmd'];
> }
>
> seems lengthy. is there a way around this?
>
> i tried using
> $cmd = @ $_POST['cmd'];
>
> to suppress errors but didnt seem to have ay effect.
>
> tx.
>
>
still
if(isset($_POST['cmd'])) {
$cmd = $_POST['cmd'];
}

is the only (really) correct way. All others throw notices of undefined
indices, which you *should not* ignore! You can't shorten it, you can't
even wrap it in a function... it's simply tough luck

[Back to original 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

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