$birthday = filter_input(INPUT_POST, 'birthday');
 $address = filter_input(INPUT_POST, 'address');
 $phone = filter_input(INPUT_POST, 'phone');
 $website = filter_input(INPUT_POST, 'website');
 $errors = array();
 // Error Validation for each Input
 if (!isValidName($fullname)) {
     $errors[] = 'Name is not Valid';
 }
 if (!isValidEmail($email)) {
     $errors[] = 'Email is not Valid';
 }
 if (!isValidBirthday($birthday)) {
     $errors[] = 'birthday is not Valid';
 }
 if (!isValidAddress($address)) {
     $errors[] = 'address is not Valid';
 }
 if (!isValidPhone($phone)) {
     $errors[] = 'Phone Number is not Valid';
 }
 if (!isValidWebsite($website)) {
     $errors[] = 'website is not Valid';
 }
 // As long as no errors are trigger it will allow the the Funtion to Add the Information to the Database
 if (count($errors) == 0) {
     if (createContact($addressgroupid, $fullname, $email, $birthday, $address, $phone, $website)) {
         $results = 'Contact Added';
     } else {
         $results = 'Contact was not Added';
     }
    die('Connection error: (' . $connect->connect_errno . '): ' . $connect->connect_error);
}
?>

<body>

<h1>Validation of Organization Addresses</h1>

<?php 
$sql = "SELECT * FROM organization";
$result = $connect->query($sql) or die($connect->error);
echo '<table border="1"><tr><th>Organization ID</th><th>Organization Name</th><th>Address</th><th>Phone</th></tr>';
while ($result2 = $result->fetch_array(MYSQLI_ASSOC)) {
    if (isValidOrgName($result2['org_name']) && isValidAddress($result2['org_street']) && isValidString($result2['org_state']) && isValidZIPCode($result2['org_zip']) && isValidPhone($result2['org_phone'])) {
    } else {
        echo '<tr><td>' . $result2['org_id'] . '</td><td>' . $result2['org_name'] . '<br>' . formatValid(isValidOrgName($result2['org_name'])) . '</td><td>' . $result2['org_street'] . ", " . $result2['org_city'] . ", " . $result2['org_state'] . " " . $result2['org_zip'] . '<br> Street:' . formatValid(isValidAddress($result2['org_street'])) . '<br>City: ' . formatValid(isValidString($result2['org_state'])) . '<br>ZIP:' . formatValid(isValidZIPCode($result2['org_zip'])) . '</td><td>' . $result2['org_phone'] . '<br>' . formatValid(isValidPhone($result2['org_phone'])) . '</td>';
        echo '</tr>';
    }
}
/* while ($result2 = $result->fetch_array(MYSQLI_ASSOC)) {
	
	echo '<tr><td>' . $result2['org_id'] . '</td><td>' . $result2['org_name'] . '<br>' . formatValid(isValidOrgName($result2['org_name'])) . '</td><td>' . $result2['org_street'] . ", " . $result2['org_city'] . ", " . $result2['org_state'] . " " . $result2['org_zip'] . '<br> Street:' . formatValid(isValidAddress($result2['org_street'])) . '<br>City: ' . formatValid(isValidString($result2['org_state'])) . '<br>ZIP:' . formatValid(isValidZIPCode($result2['org_zip'])) . '</td><td>' . $result2['org_phone'] . '<br>' . formatValid(isValidPhone($result2['org_phone'])) . '</td>';
	
	echo '</tr>';
	
} */
echo '</table>';
?>


</body>