There is post of select form like:
<select name="option[color][0]">
<select name="option[color][1]">
// option[color][2] isnt posted
Some products doesnt have that select, and then when I try to get them from post, each time if select isn't posted, im getting error like:
Undefined offset: 2
How to check if something is posted? Tried:
$ids = $_POST['id'];
$option = $_POST['option'];
foreach ($ids as $key => $id)
{
//Undefined offset: 2
if( $option['color'][$key] )
{
$_SESSION[$key]['option']['color'] = $option['color'][$key];
}
//Undefined offset: 2
if( !empty($option['color'][$key]) )
{
$_SESSION[$key]['option']['color'] = $option['color'][$key];
}
//Undefined offset: 2
if( isset($option['color'][$key]) )
{
$_SESSION[$key]['option']['color'] = $option['color'][$key];
}
//... etc
}
Etc.... what ever I try, there is error :( Please help