Click to See Complete Forum and Search --> : Undefined Variable?


Anon
06-25-2002, 06:52 PM
I just recently installed IIS 5.0, PHP 4.2.1. on my Windows2KPro computer so that I could be able to change my site without uploading files constantly. However, I seem to have a problem with PHP, because even though the phpinfo.php works fine, it gives me all sorts of undefined variable errors even in the process of defining variables.

in my index.php I included "header.php" which works fine but the first line of header.php is:

1 <?
2 if ($section == null){
3 $section = 0;
4 }

and I immediately recieve an undefined variable error for section in line 2.

I was guessing it would be a problem with my php.ini file, but nothing has worked, which is kind of funny cause it works fine on my friends computer running WinXP with the same PHP ver. Does anybody have any clues?

Anon
06-25-2002, 08:24 PM
You havent defined the variable $section and php is telling you that for a plethera of reasons why...

If you dont care that you havent defined it, you can just add an "@" (no quotes) to the beginnign of the var name ie -> @$section

That will tell it to igore the fact its not defined...

Hope that helps

Anon
06-25-2002, 08:49 PM
No....What you need to do is to set your error_reporting to a different level.

By default php on windoze reports stupid errors such as the one you encountered... Kinda like 'use strict' in PERL.

error_reporting(7);

Will only report running errors.