Re: [DOC-NL] PHP variable
[email protected] ("F.Anneveld")
| Newsgroups | php.doc.nl |
|---|---|
| Message-ID | <[email protected]> |
Thank you it works.......... This also works fine : Its just a warning. It tells you that you are using a variable which has no value. Just ignore the notice, or turn down error reporting to exclude notices. All it means is that the variable of $test which you have included in your script HAS NO VALUE. If you were to write something lile $test = "I Have A Value Now!"; then the 'error' message would disappear. Most of the time, you DO NOT WANT to give a variable a value, such as when a user submits a form to your script. The $Variables are filled by the user, not the php script. If the user misses out a field, they would see the error message you mentioned. To turn it off... go to your php.ini Search for ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Error handling and logging ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; and change the line which looks like (Make sure there is no ; at the start of the line, if there is then its the wrong line to change!) error_reporting = E_ALL to error_reporting = E_ALL & ~(E_NOTICE | E_USER_NOTICE) ; display all errors and warnings This will make php only show the errors which affect the running of your scripts, not the notices such as 'Empty Variables' Hope this helps Stephen "Derick Rethans" <[email protected]> schreef in bericht news:[email protected]... > On Mon, 18 Nov 2002, F.Anneveld wrote: > > > Hello, > > > > When I use the following code my browser comes with the following error : > > -------------------------------------------------------------------- > > PHP code: > > > > <?php > > if (!$test) echo "test does not exist"; > > ?> > > -------------------------------------------------------------------- > > Browser error: > > > > Notice: Undefined variable: test in d:\www\trash.php on line 3 > > test does not exist > > > > -------------------------------------------------------------------- > > But in PHP you don't have to declare a variable > > or do I have to ajust some setting in the PHP.ini ???? > > You should always test if a variable is set with isset(), but if you > want to be sloppy with your code you can change your error reporting > level (php.net/error_reporting). > > Further, this list is NOT for support questions, which belong on the > [email protected] mailing list. > > Derick > > -- > > -------------------------------------------------------------------------- - > Derick Rethans http://derickrethans.nl/ > JDI Media Solutions http://www.jdimedia.nl/ > -------------------------------------------------------------------------- - >