You might want to consider putting your $name vars into an array.
$myarray = array( $name1, $name2, $name3 $name4);
//this line is putting all of your $names into an array
for ($i = 0 ; $i < sizeof($myarray) ; $i++)
{
if (empty($my_array[$i])){
//checking each item in the array to see if its empty
$test == 0;
}
}
if ($test == 0) {
echo "Opps, one of your array items are empty!";
}else{
echo "None of your array items are empty!";
}
Now for some reading material:
These will help you understand some of the elements in the above code:
Arrays
sizeof ()
empty()\
This may not be the best way to accomplish what you are trying to do, but at least it will help get you pointed in the right direction 🙂