Php Tutorial Undefined index and Undefined variable solution
$ Act = $ _ POST ['AC'];
The above code always prompts
Notice: Undefined index: act in F: windsflybookpost. php on line 18
In addition
Reference content
Notice: Undefined variable: Submit ......
And so on.
Cause: The variable is undefined.
Solution:
1) error_reporting settings:
Locate error_reporting = E_ALL
Change to error_reporting = E_ALL &~ E_NOTICE
2) register_globals settings:
Find register_globals = Off
Change to register_globals = On
Notice: Undefined variable: email in D: PHP5ENOTEADDNOTE. PHP on line 9
Notice: Undefined variable: subject in D: PHP5ENOTEADDNOTE. PHP on line 9
Notice: Undefined variable: comment in D: PHP5ENOTEADDNOTE. PHP on line 9
........
Php does not need to define variables, but what should I do in this case?
Find the php. ini file in C: WINDOWS.
Row 302 in php. ini: error_reporting = E_ALL
Modify
Error_reporting = E_ALL &~ E_NOTICE: restart apache2.2.
Solution: modify php. ini
Yes: error_reporting = E_ALL
Changed to: error_reporting = E_ALL &~ E_NOTICE
If you do not want to display any errors, modify them directly:
Display_errors = Off
If you do not have permission to modify php. ini, you can add it to the php header.
Ini_set ("error_reporting", "E_ALL &~ E_NOTICE ");
You can.