include("../php/config.php");
include("../php/emailforms_config.php");
if(isset($_POST['FormType'])){
$error_message= array();
if(trim($_POST['CompanyName'])=="")
$error_message[0]= "Enter company name
";
if(trim($_POST['CompanyAddress1'])=="")
$error_message[1]= "Enter address
";
if(trim($_POST['CompanyCity'])=="")
$error_message[2]= "Enter city
";
if(trim($_POST['CompanyState'])=="")
$error_message[3]= "Enter state
";
if(trim($_POST['CompanyZip'])==""){
$error_message[4]= "Enter zip
";
}
else if(!is_numeric($_POST['CompanyZip'])) {
$error_message[4] = "Zip Must Be Numeric
";
}
if(trim($_POST['CompanyPhone1']) == ""){
$error_message[5] = "Enter Phone
";
}
else if(!IsPhoneValid($_POST['CompanyPhone1'])) {
$error_message[5] = "Use format: xxx-xxx-xxxx.
";
}
if(trim($_POST['CompanyPhoneFax']) != "" && !IsPhoneValid($_POST['CompanyPhoneFax']))
$error_message[6] = "Use format: xxx-xxx-xxxx
";
if(trim($_POST['CompanyPhone2']) != "" && !IsPhoneValid($_POST['CompanyPhone2']))
$error_message[7] = "Use format: xxx-xxx-xxxx
";
if(trim($_POST['CompanyPhone800']) != "" && !IsPhoneValid($_POST['CompanyPhone800']))
$error_message[8] = "Use format: xxx-xxx-xxxx
";
if(trim($_POST['CompanyEmail']) != "" && !IsEmailValid($_POST['CompanyEmail']))
$error_message[9] = "Email seems to be invalid
";
if(trim($_POST['ListingCategoryChoice1'])=="")
$error_message[10]= "Enter at least one category
";
if(trim($_POST['ListingDescription'])=="")
$error_message[11]= "Enter description
";
if(trim($_POST['FirstName']) == "")
$error_message[12]= "Enter first name
";
if(trim($_POST['LastName']) == "")
$error_message[13] = "Enter last name
";
if($_POST['ContactByEmail']=="yes") {
if(trim($_POST['Email']) == ""){
$error_message[20] = "Enter Email
";
}
else if(!IsEmailValid($_POST['Email'])) {
$error_message[20] = "Your email seems to be invalid.
";
}
}//if($_POST['ContactByEmail']=="yes") {
if($_POST['ContactByMail']=="yes") {
if(trim($_POST['Address1']) == ""){
$error_message[14] = "Enter Address 1
";
}
if(trim($_POST['City']) == ""){
$error_message[15] = "Enter City
";
}
if(trim($_POST['State']) == ""){
$error_message[16] = "Enter State
";
}
if(trim($_POST['Zip']) == ""){
$error_message[17] = "Enter Zip
";
}
else if(!is_numeric($_POST['Zip'])) {
$error_message[17] = "Zip Must Be Numeric
";
}
}//if($_POST['ContactByMail']=="yes") {
if($_POST['ContactByPhone']=="yes") {
if(trim($_POST['Phone']) == ""){
$error_message[18] = "Enter Phone
";
}
else if(!IsPhoneValid($_POST['Phone'])) {
$error_message[18] = "Use format: xxx-xxx-xxxx.
";
}
}
if(trim($_POST['Fax']) != "" && !IsPhoneValid($_POST['Fax'])){
$error_message[19] = "Use format: xxx-xxx-xxxx.
";
}
if($_POST['ContactByEmail']!="yes" && $_POST['ContactByMail']!="yes" && $_POST['ContactByPhone']!="yes")
$error_message[21] = "Select at least one
";
if($_POST['PrivacyRead']!="yes") {
$error_message[22] = "Please, select Yes to submit
";
}
if(count($error_message) == 0){
//post to Controller for saving in database
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://$FormSubmitURL");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $_POST);
$date = curl_exec ($ch);
//print $date;
curl_close ($ch);
Header("Location: ./thanx.html");
exit;
}
}//if
?>
|
|||||||||||||||||||||||