Solution to phpUndefinedindex and Undefinedvariable

Source: Internet
Author: User
$ Act $ _ POST [& amp; 39; act & amp; 39;]; the following code always prompts: Notice: Undefinedindex: actinF: windsflybookpostphponline18.

$ Act = $ _ POST ['AC']; the following code always prompts: Notice: Undefined index: act in F: windsflybookpost. php on line 18.

In addition, sometimes there are some such prompts as: Notice: Undefined variable: Submit...

Cause:Caused by undefined variables

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.

  1. Notice: Undefined variable: email in D: PHP5ENOTEADDNOTE. PHP on line 9
  2. Notice: Undefined variable: subject in D: PHP5ENOTEADDNOTE. PHP on line 9
  3. Notice: Undefined variable: comment in D: PHP5ENOTEADDNOTE. PHP on line 9
  4. ........

Php does not need to define variables, but what should I do in this case? In C: WINDOWS, find row 302 in php. ini and change error_reporting = E_ALL to error_reporting = E_ALL &~ E_NOTICE: restart apache2.2.

Solution: modify php. ini

Change error_reporting = E_ALL to error_reporting = E_ALL &~ E_NOTICE

If you do not want to display any errors, modify display_errors = Off.

If you do not have permission to modify php. ini, you can add ini_set ("error_reporting", "E_ALL &~ E_NOTICE ");


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.