Re: error suppresion

From: Date: Sun, 29 Sep 2002 18:29:59 +0000
Subject: Re: error suppresion
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-118109@lists.php.net to get a copy of this message
Gary wrote:
They are not really errors they are reporting that the form fields are empty until the form is submitted. Notice: Undefined index:
That means your code is not doing any checking of the incoming data. You should always check that the data coming is what you expect it to be. It's good programming practice and helps security. Just add the following to your code and every thing will be fine (assuming POST, but works with GET or any other): if (isset($_POST["myvar name"])) { $value = $_POST["myvar name"]; } else { $value = ""; } I always turn error reporting way up when coding and debugging, it helps me to find places where I have undefined variables when the variables really *should* be defined ... meaning I have a bug ;) Jc

« previous php.general (#118109) next »