<?php
ob_start();
include("includes/checkerfun.php");

$Error = "";


function ValidateFrm2(){
// tax_clearance_cert_nos
// land_purpose
// _town_and_layout
// alocation_question
// cost_development
// signature
// date_signed

    if(isset($_POST['save'])){
        if(empty(test_input($_POST['tax_clearance_cert_nos']))){
            $Error = "<p class='alert alert-danger text-center mt-3'>Tax Clearance Certificate Number is Required!</p>";
        }elseif(empty(test_input($_POST['land_purpose']))){
            $Error = "<p class='alert alert-danger text-center mt-3'>Land Purpose is Required!</p>";
        }elseif(empty(test_input($_POST['_town_and_layout']))){
            $Error = "<p class='alert alert-danger text-center mt-3'>Town and Layout is Required!</p>";
        }elseif(empty(test_input($_POST['alocation_question']))){
            $Error = "<p class='alert alert-danger text-center mt-3'>Allocation Question is Required!</p>";
        }elseif(empty(test_input($_POST['cost_development']))){
            $Error = "<p class='alert alert-danger text-center mt-3'>Cost of Development is Required!</p>";
        }elseif(empty(test_input($_POST['signature']))){
            $Error = "<p class='alert alert-danger text-center mt-3'>Signature is Required!</p>";
        }elseif(empty(test_input($_POST['date_signed']))){
            $Error = "<p class='alert alert-danger text-center mt-3'>Date Signed is Required!</p>";
        }else{
            $Error = "<p class='alert alert-success text-center mt-3'>Saved Successfully!</p>";
            // header('Refresh:5, url=register_form003.php');
            // exit();
        }


    }elseif(isset($_POST['save_continue'])){
        if(empty(test_input($_POST['tax_clearance_cert_nos']))){
            $Error = "<p class='alert alert-danger text-center mt-3'>Tax Clearance Certificate Number is Required!</p>";
        }elseif(empty(test_input($_POST['land_purpose']))){
            $Error = "<p class='alert alert-danger text-center mt-3'>Land Purpose is Required!</p>";
        }elseif(empty(test_input($_POST['_town_and_layout']))){
            $Error = "<p class='alert alert-danger text-center mt-3'>Town and Layout is Required!</p>";
        }elseif(empty(test_input($_POST['alocation_question']))){
            $Error = "<p class='alert alert-danger text-center mt-3'>Allocation Question is Required!</p>";
        }elseif(empty(test_input($_POST['cost_development']))){
            $Error = "<p class='alert alert-danger text-center mt-3'>Cost of Development is Required!</p>";
        }elseif(empty(test_input($_POST['signature']))){
            $Error = "<p class='alert alert-danger text-center mt-3'>Signature is Required!</p>";
        }elseif(empty(test_input($_POST['date_signed']))){
            $Error = "<p class='alert alert-danger text-center mt-3'>Date Signed is Required!</p>";
        }else{
            $Error = "<p class='alert alert-success text-center mt-3'>Saved Successfully!</p>";
            echo $Error;
            header('Refresh:5, url=register_form003.php');
            exit();
        }
        
        

    }

    return $Error;
}

// ob_end_flush();
