I know this question may be asked previously but I want to show my code and I would like to know that whether am doing a simple thing or complicating the code? Moreover answers say use `try` and `catch` but am going with procedural method so I would like to know that am I going right?

What I do it, for example a contact form

```
<?php
if(isset($_POST['contact'])) {
    $throw_error = array();

    //First Block Is Validation
    if($_POST['first_name'] == '' || $_POST['last_name'] == '') {
        $throw_error['field_blank'] = 'Fields Cannot Be Blank';
    } elseif(strlen($_POST['first_name']) < 3) {
         $throw_error['char_len'] = 'First Name Cannot Be Less Than 3 Characters';
    }

    //Second Block Is Process If No Errors Are Found
    if(empty($throw_error)) {
        $first_name = $_POST['first_name']; 
       //Don't worry about the sanitizing part, am doing it
       //Process the form ahead and then redirect using header()
       }
    } elseif(!empty($throw_error)) { //Third Block To Throw Error If Any Errors Found
        if(isset($throw_error['field_blank'])) {
            echo  $throw_error['field_blank'];
        } elseif(isset($throw_error['char_len'])) {
            echo  $throw_error['char_len'];
        }
    }
?>

<form>
   <input type="text" name="first_name" />
   <input type="text" name="last_name" />
   <input type="submit" value="Submit" name="contact" />
</form>

```