Re: error suppresion

From: Date: Sun, 29 Sep 2002 23:11:28 +0000
Subject: Re: error suppresion
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-118129@lists.php.net to get a copy of this message
Jean-Christian Imbeault wrote:
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 = ""; } The problem is the vars will never be set until the form is submitted. The e-notice's are for the
empty form elements before the form submission. So the "else value" would be, turn off error reporting until submission. Gary

« previous php.general (#118129) next »