$warn = 'off';
$name_1 = $_POST['name_1'];
if($name_1 == ""){
$warn = 'on';
$mess[] = 'No First Name';
}
$name_2 = $_POST['name_2'];
if($name_2 == ""){
$warn = 'on';
$mess[] = 'No Last Name';
}
$address = $_POST['address'];
if($address == ""){
$warn = 'on';
$mess[] = 'No Address';
}
$city = $_POST['city'];
if($city == ""){
$warn = 'on';
$mess[] = 'No City';
}
$state = $_POST['state'];
if($state == ""){
$warn = 'on';
$mess[] = 'No State';
}
$ZipCode = $_POST['ZipCode'];
if($ZipCode == ""){
$warn = 'on';
$mess[] = 'No Zip Code';
}
$Phone = $_POST['Phone'];
if($Phone == ""){
$warn = 'on';
$mess[] = 'No Phone';
}
$email = $_POST['email'];
if($email == ""){
$warn = 'on';
$mess[] = 'No Email';
}
$req_by = $_POST['req_by'];
$refstat = $_POST['refstat'];
$pay = $_POST['pay'];
if($refstat != 'Hold' and $pay == ""){
$warn = 'on';
$mess[] = 'No Payment Type';
}
$rate = $_POST['rate'];
if($refstat != 'Hold' and $rate == ""){
$warn = 'on';
$mess[] = 'No Payment Rate';
}
$dtnum = date(Ymd);
$dbcnx = @mysql_connect('mysql.plainhost.com', 'ecosmar_ecosmart', 'ecoman1');
mysql_select_db('ecosmar_contacts', $dbcnx);
$checkem = @mysql_query("SELECT ID FROM refcon WHERE name_1='$name_1' AND name_2='$name_2' AND email='$email'");
if (!$checkem) {
echo("
Error checking for duplicates.
" . 'Error: '. mysql_error(). '
');
}
$num_rows = mysql_num_rows($checkem);
if($num_rows >= 1){
$warn = 'on';
$dupe = '$name_1 $name_2 at $email is already on the Referrers List';
}else{
$dupe = "";
}
$chunk_dtnum = chunk_split($dtnum, 2, ':');
$chunk_arr = explode(":", $chunk_dtnum);
$datus = $chunk_arr[2].'-'.$chunk_arr[3].'-'.$chunk_arr[0].$chunk_arr[1];
if($warn == "on"){
echo("
" .
"Sorry. There is a problem with this input." .
"Please Go Back and correct the following errors: |
");
foreach($mess as $value){
echo("$value |
");
}
echo("$dupe |
");
exit();
}
?>