guvenck
12-05-2006, 10:41 PM
I send a form via POST method, the form contains an uncertain number of fields, so I use an array (let's say email[]). After sending the form, I would like to check if the array contains empty values. Naturally,
if($_POST['email'] == "") does not work even if all the fields are empty. So, I use a foreach loop to check if the array contains empty values:
$email = $_POST['email'];
foreach ($email as $key => $value){
if ($email[$key] == ""){
echo "field contains empty value";
}
}
is there any other way to check if all the items in an array contain empty values?
if($_POST['email'] == "") does not work even if all the fields are empty. So, I use a foreach loop to check if the array contains empty values:
$email = $_POST['email'];
foreach ($email as $key => $value){
if ($email[$key] == ""){
echo "field contains empty value";
}
}
is there any other way to check if all the items in an array contain empty values?