The easiest way to get rid of the errors is to correct them in the script. In production its always best to write scripts with error_reporting set to E_ALL.
Here's what's going on.
PHP is a very loose, flexible language. It doesn't require variables to be initialized, that is to be created before they are used or referenced in a script.
It isn't a good idea to suppress these errors, because they are, after all, errors. There's sound reasoning behind the PHP group deciding that these types of errors need to be reported.
Take for instance this example:
$variable = 1;
if ($varaible == 1)
// do stuff
Its a common mistake to mispell a variable, if NOTICE errors are suppressed you'd have no idea what happened. With NOTICE errors activated, PHP complains that '$varaible' doesn't exist, alerting you to the mispelled variable. Put this in the context of a 2000 line script and you begin to see why it is useful.
So, NOTICE errors like this alert you that you've used a variable that doesn't exist.
There are ways of supressing them in a script without supressing the error reporting, and that is to use the language constructs isset() and empty().
isset() is like a function, but it isn't a function, it's a language construct. It preforms a special task, like echo or print. isset determines whether a variable exists, if a variable exists it returns TRUE, if the variable doesn't exist it returns FALSE. empty, which is closely related determines whether a variable has a value, if a variable exists and has a value other than 0, NULL, FALSE, "", it returns FALSE, if the variable doesn't exist, or doesn't have a value, e.g. is NULL, empty, FALSE, 0, "" (the values indicating absense of value) it returns TRUE. Use of these constructs don't trigger NOTICE errors.
To see this in action...
if (isset($variable) && !empty($variable))
// $variable exists and isn't empty.. Do stuff.
// Create some error reporting to alert you to the
// the fact that $variable doesn't exist or is empty
// or do other stuff when the $variable doesn't exist
// or is empty.
This is part of the process of identifying places in your script where errors can potentially arise, and where you would take the opportunity to eliminate the possibility of those errors by implementing validation of your variables to ensure that they contain the values that you expect, whereas you may write the code to alert you or the user when things like this arise.
By ensuring that the variables that you create contain the values that you expect you also , naturally, create more secure code. You can read up on this here:
A PHP/C-Client/PEAR solution for webmail