Thanks for your reply NogDog,
The bigger problem than feeding an array into the loop is to assign the variables though. Here is what I have so far (not working though)
$postKeys = array('contact_name','contact_number','email');
foreach($postKeys as $key) {
$variable = "$'$key'";
if(isset($_POST["$key"])) {
$variable = htmlentities($_POST["$key"]);
}
else {
$variable = '';
}
}