Possible Duplicate:
PHP: “Notice: Undefined variable” and “Notice: Undefined index”
This is strange but I am posting an input using the $_POST method which is below:
$c = count($_POST['gridValues']);
But the problem is that I am receiving an error stating:
Notice: Undefined index: gridValues in /web/stud/..../ on line 40 (which is line above)
How come I am receiving this error because the $_POST method is definitly correct?
Below is the whole code:
<?php
ini_set('session.gc_maxlifetime',12*60*60);
ini_set('session.gc_divisor', '1');
ini_set('session.gc_probability', '1');
ini_set('session.cookie_lifetime', '0');
require_once 'init.php';
ini_set('display_errors',1);
error_reporting(E_ALL);
session_start();
?>
$i = 0;
$c = count($_POST['gridValues']);
for($i = 0; $i < $c; $i++ ){
switch ($_POST['gridValues'][$i]){
case "3":
$selected_option = "A-C";
break;
case "4":
$selected_option = "A-D";
break;
case "5":
$selected_option = "A-E";
break;
}
}