I have since recently turned up my error reporting on a production site
to E_ALL to ensure I am using 'best practices' when writing out code.
So far it has helped me discipline myself with initializing my
variables. I am running into a problem with my $_POST array though.
I am self-referencing a form page for processing, so at the beginning I
am looking for the existence of certain $_POST variables for processing.
I am setting an 'action' field to 'login' for example.
I have done this on several occasions with no problems and even in this
case there is no fatal error. I am however receiving a NOTICE that my
$_POST variables I am looking at is undeclared.
"Notice: Undefined index: action"
I cannot openly see a way to declare the $_POST['action'] prior to
checking it since it is set by the server when the page is loaded.
Here is my actual code snippet:
if($_POST['action'] === 'login') {
//process data//
}
Will I need to learn to ignore this specific error or is there something
I am not seeing?
Thanks
Scotty
to E_ALL to ensure I am using 'best practices' when writing out code.
So far it has helped me discipline myself with initializing my
variables. I am running into a problem with my $_POST array though.
I am self-referencing a form page for processing, so at the beginning I
am looking for the existence of certain $_POST variables for processing.
I am setting an 'action' field to 'login' for example.
I have done this on several occasions with no problems and even in this
case there is no fatal error. I am however receiving a NOTICE that my
$_POST variables I am looking at is undeclared.
"Notice: Undefined index: action"
I cannot openly see a way to declare the $_POST['action'] prior to
checking it since it is set by the server when the page is loaded.
Here is my actual code snippet:
if($_POST['action'] === 'login') {
//process data//
}
Will I need to learn to ignore this specific error or is there something
I am not seeing?
Thanks
Scotty
Comment