I have an array that goes like this
$array = array('key1' => $_GET['value1'], 'key2' => $_GET['value2']);
I want to check if the key's value is not empty. Say a user goes to the webpage and requests this http://mysite.com/page.php?value1=somevalue&value2= which means that value2 is empty or say that it is missing from the query string i want to be able to check if it's there and is not empty.
I tried this
foreach($array as $key => $value)
{
if(empty($value))
{
//spout some error
}
}
but even though i enter this http://mysite.com/page.php?value1=somevalue meaning that value2 is missing, i don't get the error.
How do i achieve what i want?