As the question says i need to validate a multidimensional array, just so you know this is my first time actually using arrays so it might be a pretty bad script but it works and that's all I'm after at the moment. Okay so it's working I have two sessions displaying in this array, when i remove one of the sessions I get this error
"Notice: Undefined index: pop in C:\inetpub\wwwroot\dropdown\test.php on line 30"
I think i know how to fix it but I don't actually know how to implement it. this is me talking through what im after
$myarray (
IF isset session cityname
add the value to my array
ELSE
add a blank value in its place (or just remove it from the array altogether)
IF isset session pop
add the value to my array
ELSE
add a blank value in its place (or just remove it from the array altogether)
echo myarray
please note cityname is mandatory whereas pop is not
That's essentially what I'm trying to achieve but i haven't the slightest how to actually go about doing it, here is my current code
if(isset($_SESSION['cityname'])){
$myarray = array(array($_SESSION['cityname']),
array($_SESSION['pop'])
);
foreach($myarray as $key=>$value){
echo $myarray[$key][0];
}
Any help MUCH appreciated I've lost to much hair to this problem the last couple of weeks!