Three solutions to the appearance of notice: undefined index in PHP

This WARNING is a NOTICE or WARNING for a different version of PHP. It is not an ERROR. PHP works fine when variables are used undeclared in PHP, but in a PHP5 environment, the above warning or prompt will appear. After the search query, we conclude the following three methods to solve Notice: Undefined Index.

the first method: modify the PHP configuration file, to block such warnings and tips to modify the PHP. Ini configuration file, modify the error_reporting for error_reporting = E_ALL & amp; ~ E_NOTICE. Notice and WARNING in the program will be ignored, of course, this is not suitable for beginners, not only inconvenient to debug the program, and is not conducive to the formation of good code habits.

the second method: initialized for each variable assigned a null or any value, does not affect the operation. $blank = “; $blank = “; $blank = “; $price = “15” :$car = “Truck” :

price = “15” :$car = “Truck” :

modifier disallows warnings caused by function calls, but this modifier does not disallow the display of errors.

Read More: