Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.66 KB | None | 0 0
  1. <?php
  2.     if(isset($_POST[submit])){
  3.           $error='';//set $error to blank
  4.           if(strlen($_POST[FirstName]) == 0){
  5.             $errorFname.="A Valid First Name Is Required!<br />";
  6.           }
  7.           if(strlen($_POST[LastName]) == 0){
  8.             $errorLname.="A Valid Last Name Is Required!<br />";
  9.           }
  10.           if(strlen($_POST[CompanyName]) == 0){
  11.             $errorCname.="A Valid Company Name Is Required!<br />";
  12.           }
  13.           if(strlen($_POST[CompanyAddress]) == 0){
  14.             $errorCaddress.="A Valid Address Is Required!<br />";
  15.           }
  16.           if(strlen($_POST[CompanyCity]) == 0){
  17.             $errorCcity.="A Valid City Is Required!<br />";
  18.           }
  19.           if(strlen($_POST[CompanyState]) <> 2){
  20.             $errorCstate.="A Valid State Is Required!<br />";
  21.           }
  22.           if(trim($_POST[CompanyZip])=='' || strlen(trim($_POST[CompanyZip])) <> 5){
  23.               $errorCzip.="A Valid Zip Code is Required!<br />";
  24.           }
  25.           if(strlen($_POST[CompanyWebsite]) < 3){
  26.               $errorCwebsite.="Please enter a valid Website!<br />";
  27.           }
  28.           if(trim($_POST[CompanyEmail])==''){
  29.             $errorCemail.="An email address is required!<br />";
  30.           }
  31.     else{
  32.         if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $_POST[CompanyEmail])) {
  33.         $errorCemail2="The e-mail you entered was not in the proper format!";  
  34.          }
  35.     }
  36.   if($errorFname=='' AND $errorLName=='' AND $errorCName=='' AND $errorCAddress=='' AND $errorCState=='' AND $errorCZip=='' AND $errorCWebsite=='' AND $errorCEmail=='' AND $errorCEmail2==''){//no text is in $error, the page has verified
  37.          $pass="1";
  38.     }else{
  39.        echo "<span style=color:red>$error</span>";
  40.        $pass="0";
  41.     }                
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement