This problem occurs when you enable the error prompt in php, you will be notified of some programming errors. next I will analyze phpNotice: Undefinedindex error prompt method for you, for more information, see.
This problem occurs when you enable the error prompt in php, you will be notified of some programming errors. next I will analyze the php Notice: Undefined index error prompt method for you, for more information, see.
Cause analysis
This problem is generally caused by undefined variables.
Example
The code is as follows:
If ($)
{
Echo $;
}
Else
{
}
// Prompt: Notice: Undefined variable: a in E:/www/test. php on line 5
The code is as follows:
// Solution
$ A = 1;
If ($)
{
Echo $;
}
Else
{
}
// Output 1
// Add it to the header of the article
Error_reporting (0 );
If ($)
{
Echo $;
}
Else
{
}
Solution summary
1. if a variable does not apply for a direct name, such as $ a = 1.
2. add error_reporting (0) to the header of the article. no errors are prompted.
3. isset ($ _ GET ["page"]) or: @ $ page = $ _ GET ["page"]
4. use error_reporting = E_ALL & ~ in php. ini &~ E_NOTICE can disable the display of notice, so it is good to block such warnings,