'; } else { if ($_POST['getBrochure']) { $nameError = ""; $companyError = ""; $phoneError = ""; $cityError = ""; $stateError = ""; $zipError = ""; $emailError = ""; $addressError = ""; $captchaError = ""; $countryError = ""; $errors = 0; if (!preg_match("|^[-0-9a-z_\.]+@[-0-9a-z_^\.]+\.[a-z]{2,6}$|i", $_POST['email'])) { $emailError = "

Email is incorrect!

"; $errors++; } if (empty($_POST['address'])) { $addressError = "

Insert your address!

"; $errors++; } if (empty($_POST['name'])) { $nameError = "

Insert your name!

"; $errors++; } if (empty($_POST['country'])) { $countryError = "

Insert your country!

"; } if (empty($_POST['company'])) { $companyError = "

Insert your company name!

"; $errors++; } if (empty($_POST['phone'])) { $phoneError = "

Insert your phone number!

"; $errors++; } if (empty($_POST['city'])) { $cityError = "

Insert your city!

"; $errors++; } if (empty($_POST['state'])) { $stateError = "

Insert your state!

"; $errors++; } if (empty($_POST['zip'])) { $zipError = "

Insert your zip number!

"; $errors++; } if ($_POST['captcha'] != strtolower($_SESSION['captcha'])) { $captchaError = "

Inserted captcha is incorrect!

"; $errors++; } if ($errors > 0) { $form = ""; } else { $_SESSION['brochure_fill_form'] = 1; $query = mysqli_query($connection,"SELECT `brochure` FROM brochures WHERE brochures_id = ".$bid); $brochure = mysqli_fetch_row($query); $file = BASE_DIR."documents/".$brochure[0]; if (file_exists($file)) { $mailText = "Name: ".$_POST['name']."\n Email: ".$_POST['email']."\n Country: ".$_POST['country']."\n Company: ".$_POST['company']."\n Phone: ".$_POST['phone']."\n Address: ".$_POST['address']."\n City: ".$_POST['city']."\n State: ".$_POST['state']."\n Zip: ".$_POST['zip']."\n Download file: ".$brochure[0]; mail($recipent, "Download brochure", $mailText); ?> Please, enter your information for brochures download!

'; } } } echo $form; ?>