Reply to Re: PHP error help

Your name:

Reply:


Posted by Peter van Schie on 12/07/05 00:56

mike wrote:
> If this is my first bit of code:
>
> if ($var == "value") {
> do something
> }
>
> and $var isn't defined in the url string, or via a FORM post or hidden
> variable then is this the reason why I keep getting errors like this?
>
> [Tue Dec 6 10:02:51 2005] [error] PHP Notice: Undefined variable: var in
> /usr/home/mike/index.php on line 3
>
> which are apparently causing my server to crash? does $var need to be
> defined before I can use it in a if statement? ie myurl/index.php?var=blah

Hi Mike,

Try
if ($_GET['var'] == "value")
{
// do something
}

In php.ini the setting register_globals is set to Off by default as of
PHP version 4.2 (if I remember correctly).

HTH.
Peter.
--
http://www.phpforums.nl

[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

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