Sure you can turn them off, but turning off the E_NOTICE level errors isn't a very good idea. Not seeing these errors can lead to you missing all kinds of potential logic errors and security holes. It's better to just initialize the variables. There's a reason that these errors exist! You should validate variables that come in from outside sources anyway, otherwise anyone who wants to can pass bunk information to your scripts.
I see people always assigning the values of $_POST and $_GET variables to other variables, I think that's a waste of time and space! What I would suggest is rewriting your scripts to use these variables where they're acutally used in the context of the script, it makes your scripts easier to understand and more lightweight.
Consider this rewrite of your code:
<?php
// snip
function check(&$var)
{
return (isset($var))? $var : '';
}
echo " <tr>\n".
" <td class='Label1Text'>\n".
" LINE NO:\n".
" </td>\n".
" <td class='text8Arial1'>\n".
" <INPUT name='line' VALUE='".check($_POST['line'])."'>\n".
" </td>\n".
" </tr>\n".
" <tr>\n".
" <td class='Label1Text'>\n".
" INVOICE DATE:\n".
" </td>\n".
" <td class='text8Arial1'>\n".
" <INPUT name='date' VALUE='".check($_POST['date'])."'>\n".
" </td>\n".
" </tr>\n".
" <tr>\n".
" <td class='Label1Text'>\n".
" INVOICE NO:\n".
" </td>\n".
" <td class='text8Arial1'>\n".
" <INPUT name='no' VALUE='".check($_POST['no'])."'>\n".
" </td>\n".
" </tr>\n".
" <tr>\n".
" <td class='Label1Text'>\n".
" YOUR PO NO:\n".
" </td>\n".
" <td class='text8Arial1'>\n".
" <INPUT name='po' VALUE='".check($_POST['po'])."'>\n".
" </td>\n".
" </tr>\n".
" <tr>\n".
" <td class='Label1Text'>\n".
" DN NO:\n".
" </td>\n".
" <td class='text8Arial1'>\n".
" <INPUT name='dn' VALUE='".check($_POST['dn'])."'>\n".
" </td>\n".
" </tr>\n".
"</table>\n";
?>
[/code]
Instead of writing something like:
echo (isset($_POST['line']))? $_POST['line'] : '';
over and over again I've created a function that does that for me, although I'd validate the data even more to be sure that I'm getting the information requested in the form, but for the sake of argument if I just want to test if the variable isset, I pass it by reference to the function, in the function definition that's what the amphersand in front of the variable means, what that does is send the variable to the function but while inside of the function the variable being referenced there is the original and not a copy of it.
Here's more on references:
http://www.php.net/manual/en/language.references.php
So you can use isset and empty to test for values and eliminate the E_NOTICE level error. These errors can be helpful too. What if you mispelled a variable?? It might take hours to track down if E_NOTICE level errors are turned off. Just speaking from personal experience I'd rather have all error information available to me.
The security benefits are also worth mentioning but I'll leave it to the manual to explain them.
http://www.php.net/manual/en/security.errors.php
HTH!
Regards,
Rich
::::::::::::::::::::::::::::::::::::::::::
The Spicy Peanut Project
http://www.spicypeanut.net
::::::::::::::::::::::::::::::::::::::::::