I have a contact form which I need validating in PHP to check if each field is correctly filled.

Here is what I have:

```
//Post fields
<?php
$field_name = $_POST['name'];
$field_email = $_POST['email'];
$field_services = $_POST['services'];
$field_it = $_POST['it'];
$field_location = $_POST['location'];
$field_message = $_POST['message'];

//mail_to omitted 

//Validation of contact form

$errormessage = '';
if($field_name == ''){

$errormessage += 'You have not entered your Name\n';
}

if($field_email == ''){

$errormessage += 'You have not entered your Email Address\n';
}

if($field_services == ''){

$errormessage += 'You have not chosen the service you require\n';
}

if($field_it == ''){

$errormessage += 'You have not chosen the Date of your event\n';
}

if($field_location == ''){

$errormessage += 'You have not entered the location of your event\n';
}

if($errormessage != ''){ ?>

<script language="javascript" type="text/javascript">
    alert('The following fields have not neen entered correctly\n<?php echo "$errormessage" ?>');
    window.location = 'contact.html';
</script>
<?php } 

if ($mail_status) { ?>
<script language="javascript" type="text/javascript">
    alert('Thank you for the message. We will contact you shortly.');
    window.location = 'contact.html';
</script>
<?php
}

else { ?>
<script language="javascript" type="text/javascript">
    alert('Message failed. Please, send an email to s_ejaz@live.co.uk');
    window.location = 'contact.html';
</script>
<?php
}
?>

```

This does nothing when I try to submit an empty contact form, it should alert the user of the particular fields which were not filled but it doesn't. It just takes me to a blank white page.

Could anyone help me find where I am going wrong?