Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $error = "";
- if (isset($_POST['submit'])) {
- $name = trim($_POST['name']);
- $social = ($_POST['social']);
- $number = ($_POST['number']);
- $email = $_POST['email'];
- $license = $_POST['license'];
- $address = $_POST['address'];
- $city = $_POST['city'];
- $state = $_POST['state'];
- $zip = $_POST['zip'];
- $years = $_POST['years'];
- $landlord = $_POST['landlord'];
- $phone1 = $_POST['phone1'];
- $employer = $_POST['employer'];
- $address2 = $_POST['address2'];
- $city2 = $_POST['city2'];
- $state2 = $_POST['state2'];
- $zip2 = $_POST['zip2'];
- $phone3 = $_POST['phone3'];
- $years2 = $_POST['years2'];
- $gross1 = $_POST['gross1'];
- $per1 = $_POST['per1'];
- $take1 = $_POST['take1'];
- $per2 = $_POST['per2'];
- # Validate name
- if (!ctype_alpha(str_replace(array("'", "-"), "",$name))) {
- $error .= '<p class="error"> name should be alpha characters only.</p>';
- }
- # Validate Social Security No
- if (!ctype_digit($social) OR strlen($social) != 10) {
- $error .= '<p class="error">Enter a valid Social Security No. number.</p>';
- }
- # Validate Phone #
- if (!ctype_digit($number) OR strlen($number) != 11) {
- $error .= '<p class="error">Enter a Phone number(day).</p>';
- }
- # Validate Email #
- if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
- $error .= '<p class="error">Enter a valid email address.</p>';
- }
- # Validate license
- if (!ctype_digit($license) OR strlen($license) != 8) {
- $error .= '<p class="error">Enter a valid license number.</p>';
- }
- # Validate address
- if (!ctype_alpha(str_replace(array("'", "-"), "",$address))) {
- $error .= '<p class="error"> Address should be alpha characters only.</p>';
- }
- # Validate city
- if (!ctype_alpha(str_replace(array("'", "-"), "",$city))) {
- $error .= '<p class="error">City should be alpha characters only.</p>';
- }
- # Validate State
- if (!ctype_alpha(str_replace(array("'", "-"), "",$state))) {
- $error .= '<p class="error">State should be alpha characters only.</p>';
- }
- # Validate Zip
- if (!ctype_digit($zip) OR strlen($zip) != 4) {
- $error .= '<p class="error">Enter a Zip Code</p>';
- }
- # Validate landlord name
- if (!ctype_alpha(str_replace(array("'", "-"), "",$landlord))) {
- $error .= '<p class="error">Landlords name should be alpha characters only.</p>';
- }
- # Validate Phone #1
- if (!ctype_digit($phone1) OR strlen($phone1) != 11) {
- $error .= '<p class="error">Enter a Phone number(applicant).</p>';
- }
- # Validate current employee
- if (!ctype_alpha(str_replace(array("'", "-"), "",$employer))) {
- $error .= '<p class="error">Current Employee name should be alpha characters only.</p>';
- }
- # Validate current employee address
- if (!ctype_alpha(str_replace(array("'", "-"), "",$address2))) {
- $error .= '<p class="error"> Current employee Address should be alpha characters only.</p>';
- }
- # Validate current employee city
- if (!ctype_alpha(str_replace(array("'", "-"), "",$city2))) {
- $error .= '<p class="error">Current employee City should be alpha characters only.</p>';
- }
- # Validate current employee State
- if (!ctype_alpha(str_replace(array("'", "-"), "",$state2))) {
- $error .= '<p class="error">Current employee State should be alpha characters only.</p>';
- }
- # Validatecurrent employee Zip
- if (!ctype_digit($zip2) OR strlen($zip2) != 4) {
- $error .= '<p class="error">Enter a Zip Code</p>';
- }
- # Validate current gross
- if (!ctype_digit($gross1) OR strlen($gross1) != 4) {
- $error .= '<p class="error">Enter an amount</p>';
- }
- # Validate current employee gross per
- if (!ctype_alpha(str_replace(array("'", "-"), "",$per1))) {
- $error .= '<p class="error">pls type a month</p>';
- }
- # Validate current take home pay
- if (!ctype_digit($take1) OR strlen($take1) != 4) {
- $error .= '<p class="error">Enter an amount</p>';
- }
- # Validate current employee take home per
- if (!ctype_alpha(str_replace(array("'", "-"), "",$per2))) {
- $error .= '<p class="error">pls type a month</p>';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement