Esempio n. 1
0
			<div id="container">
				<div id="headerContent" class="center">
						<h1>The Big Boss Company</h1>
				</div>
<?php 
if (isset($_POST['submit'])) {
    // Get the form data and trim whitespace
    $email = trim($_POST['email']);
    $message = trim($_POST['message']);
    $errors = [];
    // Error array
    // Validate the form fields for empty, numeric and RegEx pattern ( Email )
    if (isFormFieldInvalid($email, array('numeric', 'empty')) || !preg_match(REGEX_EMAIL, $email)) {
        $errors[] = 'Email address is not valid!';
    }
    if (isFormFieldInvalid($message, array('empty'))) {
        $errors[] = 'Message is empty!';
    }
    // Validate for the 500 character message limit ( 1 - 500 inclusive )
    $numberOfCharacters = strlen($message);
    $charOverLimit = $numberOfCharacters - MESSAGE_CHAR_LIMIT;
    if ($numberOfCharacters > MESSAGE_CHAR_LIMIT) {
        $errors[] = 'Your message has <span class="fail">' . $charOverLimit . '</span> characters over the ' . MESSAGE_CHAR_LIMIT . ' character limit!';
    }
    if (count($errors) > 0) {
        echo '<div class="textCenter">';
        foreach ($errors as $errorType) {
            echo '<p>' . $errorType . '</p>';
        }
        echo '<br/><p>Please review your entry <a href="javascript:history.back()">HERE</a></p></div>';
    } else {
Esempio n. 2
0
 if ($invalidStatus) {
     array_push($errors, "'First Name' field is not valid!");
 }
 $invalidStatus = isFormFieldInvalid($lastName, array("numeric", "empty"));
 if ($invalidStatus) {
     array_push($errors, "'Last Name' field is not valid!");
 }
 $invalidStatus = isFormFieldInvalid($address, array("empty"));
 if ($invalidStatus) {
     array_push($errors, "'Address' field is not valid!");
 }
 $invalidStatus = isFormFieldInvalid($postalCode, array("empty"));
 if ($invalidStatus) {
     array_push($errors, "'Postal Code' field is not valid!");
 }
 $invalidStatus = isFormFieldInvalid($totalIncome, array("string", "empty"));
 if ($invalidStatus) {
     array_push($errors, "'Total Income' field is not valid!");
 }
 // Based on the errors...display what's wrong or display the output
 if (count($errors) > 0) {
     echo "<div class='container'>";
     foreach ($errors as $output) {
         echo $output . "<br/>";
     }
     echo "<a href=\"taxReturn.php\">CLICK HERE TO GO BACK</a>" . "</div>";
 } else {
     // Setup the time, date, and year for Atlantic Canada.
     date_default_timezone_set('America/Halifax');
     $timeDateYearString = date("g:i A T | F j | Y");
     /*
Esempio n. 3
0
    if (isFormFieldInvalid($veggieSprouts, array("string"))) {
        array_push($errors, "Sprouts entry is invalid");
    }
    if (isFormFieldInvalid($veggieCauliflower, array("string"))) {
        array_push($errors, "Cauliflower entry is invalid");
    }
    if (isFormFieldInvalid($firstName, array("numeric", "empty"))) {
        array_push($errors, "Firstname is invalid");
    }
    if (isFormFieldInvalid($lastName, array("numeric", "empty"))) {
        array_push($errors, "Lastname is invalid");
    }
    if (isFormFieldInvalid($email, array("empty"))) {
        array_push($errors, "Email is invalid");
    }
    if (isFormFieldInvalid($phoneNumber, array("string", "empty"))) {
        array_push($errors, "Phone number is invalid");
    }
    // Start the DIV for the order results page to keep everything formatted
    ?>
<div class="orderResults center"><?php 
    // Display errors if any...
    if (count($errors) > 0) {
        foreach ($errors as $theError) {
            echo $theError . "<br/>";
        }
        echo "<br/>There were some problems.  Please re-enter the order by clicking <a href=\"orderVegetables.php\">HERE</a>";
    } else {
        if ($debug) {
            echo " <br/>the directory is : " . $myDir . "<br/>";
        }