// Loop into required fields and make sure they match our needs
foreach($required_fields as $field) {
// the field has been submitted?
if(!array_key_exists($field, $_POST)) array_push($validation, $field);

// check there is information in the field?
if($_POST[$field] == ”) array_push($validation, $field);

It is pointless for you to post raw code – you need to use code blocks (indent everything 4 spaces), or, preferably, use a service *intended* to display code – for example, a [pen](http://codepen.io) or a [gist on github](http://gist.github.com). As you can see yourself, the code you posted has been filtered, formatted, and is now completely unreadable.

>i keep gettting a 404 error when i press the submit button.

Do you _know_ what a “404” error is?

It means the page was not found: i.e., there was nothing at the URL the browser asked for.

Look at your code: make sure the value in your form’s `action` attribute is the correct location of the file that processes the form submission.