You are here: Re: Errors in php 5.0.4 Not in 4.3.10-16 « PHP Programming Language « IT news, forums, messages
Re: Errors in php 5.0.4 Not in 4.3.10-16

Posted by myname on 11/30/05 12:15

Han Koster wrote:
> I use the following statements:
>
> $var = "";
> $var = $_POST('varname');
>
> In php 4, when 'varname' was not defined, $var remained an empty string;
> In php 5, I suddenly get errors.
>
> I solved these by including the function array_key_exist to check the
> occurence of 'varname'
> Is this the prefered way or is ther a better solution?

It depends on php.ini

Do it like this, and you will never see an ugly notice again:

$var = isset($_POST['varname']) ? $_POST['varname'] : "";

 

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

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