A PHP program done in the previous paragraph is running normally, when someone gets a native test, there is always a "notice:undefined index:" Warning, which is just a warning (Notice or warning), which is a different version of PHP, not an error ( ERROR). When the variables in PHP are used without declaration, the PHP4 runs normally, but in the PHP5 environment, the above warnings or prompts appear. After search query, summed up the following three ways to solve notice:undefined index. The first method: Modify the PHP configuration file, block out such warnings and prompts to modify the php.ini configuration file, modify the error_reporting to Error_reporting = E_all & ~e_notice. Such procedures exist notice and warning shortcomings of the time will be ignored, of course, this is not suitable for beginners, not only inconvenient debugging procedures, and not conducive to the formation of good code habits. The second method is to initialize each variable with a null value or any value, without affecting the operation. This is cumbersome for more variable programs, but it is good practice to set the variables in advance, such as: $blank = ""; $price = "15″: $car =" Truck ": the third method: adding" @ "in front of each variable is easy and practical, Generally the second and the third combination of use.
The @ modifier suppresses the warning caused by a function call, but this modifier cannot suppress an error.
Excerpted from http://blog.csdn.net/stellaah/article/details/7631727
Three solutions for notice:undefined index appearing in PHP