|
|
Undefined index error PHP - PHP
|
Views : 795
|
|
Tagged in : PHP
|
|
|
Report This Scrap as Inappropriate We request you to choose the appropriate categroy and subcategory that suits your
objectionable concern about the scrap, So that our team can review and find out whether it violates our Guidelines or the
scrap is not suitable for all viewers.
|
Undefined index error PHP
This error appears because of your PHP error reporting settings. Usually, it appears when your variable is not properly set.
There are two ways to handle this issue:
1. Check if $_POST['action'] is set before using it. For example:
if (!isset($_POST['action']))
{
//If not isset -> set with dumy value
$_POST['action'] = "undefine";
}
2. Suppress Notice warnings
Notice warnings could be suppressed by changing the error_reporting variable in your PHP.ini. error_reporting could be set to show all errors except those for notices and coding standards warnings: error_reporting = E_ALL & ~E_NOTICE
The same is accomplished by adding the following line in your php page:
<?php error_reporting (E_ALL ^ E_NOTICE); ?> |
|
By Nirmala, On - 2010-05-04 |
|
|
|