$lighting_methodsErr = "Lighting method is Required !";
    } else {
        $lighting_methods = test_input($_POST["lighting_methods"]);
    }
    if (empty($_POST["lighting_duration"])) {
        $lighting_durationErr = "Lighting Duration is Required !";
    } else {
        $lighting_duration = test_input($_POST["lighting_duration"]);
    }
    if (empty($_POST["rooms_lit"])) {
        $rooms_litErr = "Number of lit rooms is Required !";
    } else {
        $rooms_lit = test_input($_POST["rooms_lit"]);
    }
    if (!empty($first_name) && (!empty($second_name) || !empty($last_name)) && !empty($gender) && !empty($passport) && !empty($country) && !empty($province) && !empty($district) && !empty($county) && !empty($division) && !empty($location) && !empty($gender) && !empty($nearest_town) && !empty($gps) && !empty($mobile) && !empty($marital_status) && !empty($family_size) && !empty($rooms) && !empty($connected) && !empty($distance) && !empty($energy_source) && !empty($cooking_methods) && !empty($cooking_frequency) && !empty($cooking_type) && !empty($lighting_methods) && !empty($lighting_duration) && !empty($rooms_lit) && !empty($household_head) && !empty($household_category) && !empty($building_materials) && !empty($income_sources) && !empty($main_income_source) && !empty($monthly_income)) {
        if ($model->addUser($first_name, $second_name, $last_name, $gender, $passport, $country, $province, $county, $district, $division, $location, $nearest_town, $gps, $postal_address, $postal_town, $mobile, $email, $marital_status, $household_head, $household_category, $building_materials, $income_sources, $main_income_source, $monthly_income, $family_size, $rooms, $connected, $distance, $energy_source, $cooking_methods, $cooking_frequency, $cooking_type, $lighting_methods, $lighting_duration, $rooms_lit) > 0) {
            header("location: clients.php");
        } else {
            $error = "Addition of new client failed !";
        }
    } else {
        $error = "You did not fill all the required fields !";
    }
}
?>
<html>
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <script type="text/javascript" src="../local/webfxlayout.js"></script>
        <link id="luna-tab-style-sheet" type="text/css" rel="stylesheet" href="../css/luna/tab.css" disabled="disabled" />