Solution to Undefinedindex and Undefinedvariable in php
This prompt always appears in the php project process. at first, $ act was used to accept the data from form post: $ act =$ _ POST ['AC']; This prompt always appears in the php project process. at first, $ act was used to accept the data from form post: $ act =$ _ POST ['AC']; The above code always prompts: Notice: Undefined index: act in F: \ windsflybook \ post. php on line 18 In addition, some such prompts may also appear: Notice: Undefined variable: Submit. Cause: The variable is undefined. Solution: 1) error_reporting settings: locate error_reporting = E_ALL and change it to error_reporting = E_ALL &~ E_NOTICE 2) register_globals settings: find register_globals = Off and change it to register_globals = On Notice: Undefined variable: email in D: \ PHP5 \ ENOTE \ ADDNOTE. PHP on line 9 Notice: Undefined variable: subject in D: \ PHP5 \ ENOTE \ ADDNOTE. PHP on line 9 Notice: Undefined variable: comment in D: \ PHP5 \ ENOTE \ ADDNOTE. PHP on line 9 ........ php does not need to define variables, but what should I do in this case? In C: \ WINDOWS, find the 302 line error_reporting = E_ALL of php. ini in php. ini and change it to error_reporting = E_ALL &~ Restart apache2.2 after E_NOTICE. Solution: modify php. ini and change error_reporting = E_ALL to error_reporting = E_ALL &~ E_NOTICE: display_errors = Off if you do not want to display any errors. if you do not have the permission to modify php. ini, you can add ini_set ("error_reporting", "E_ALL &~ E_NOTICE "); |