$voornaam_brdr = '';
$achternaam_brdr = '';
$email_brdr = '';
$telefoon_brdr = '';
$straat_nr_brdr = '';
$postcode_brdr = '';
$plaatsnaam_brdr = '';
$type_0 = '';
$type_1 = '';
$type_2 = '';
$type_3 = '';
$type_4 = '';
$el_bediening_ja = 'checked';
$el_bediening_nee = '';
$incl_installatie_ja = 'checked';
$incl_installatie_nee = '';
$verdieping_0 = 'checked';
$verdieping_1 = '';
$verdieping_2 = '';
$verdieping_3 = '';
$aanhef_dhr = '';
$aanhef_mevr = '';
$vorm_ja = 'checked';
$vorm_nee = '';
$land_nl = 'checked';
$land_b = '';
$land_de = '';
$land_anders = '';
$contact_email = '';
$contact_telefoon = '';
$display_proces = 'none';
if (isset($_POST['aanvragen']))
{
// offerte
$omschrijving = htmlentities(trim(strip_tags($_POST['omschrijving'])));
$selType = '';
if (isset($_POST['type']))
{
$type = $_POST['type'];
if (in_array('knikarmschermen', $_POST['type'])) { $type_0 = 'checked'; }
if (in_array('markiezen', $_POST['type'])) { $type_1 = 'checked'; }
if (in_array('rolluiken', $_POST['type'])) { $type_2 = 'checked'; }
if (in_array('screens', $_POST['type'])) { $type_3 = 'checked'; }
if (in_array('uitvalschermen', $_POST['type'])) { $type_4 = 'checked'; }
foreach ($type as $typekeuze)
{
$selType .= $typekeuze . ', ';
}
$selType = substr($selType, 0, -2);
}
$aantal = htmlentities(trim(strip_tags($_POST['aantal'])));
$afmetingen = htmlentities(trim(strip_tags($_POST['afmetingen'])));
$kleur = htmlentities(trim(strip_tags($_POST['kleur'])));
$el_bediening = $_POST['el_bediening'];
if (isset($_POST['el_bediening']))
{
if ($_POST['el_bediening'] == 'ja') { $el_bediening_ja = 'checked'; }
if ($_POST['el_bediening'] == 'nee') { $el_bediening_ja = 'checked'; }
}
$incl_installatie = $_POST['incl_installatie'];
if (isset($_POST['incl_installatie']))
{
if ($_POST['incl_installatie'] == 'ja') { $incl_installatie_ja = 'checked'; }
if ($_POST['incl_installatie'] == 'nee') { $incl_installatie_ja = 'checked'; }
}
$selVerdieping = '';
if (isset($_POST['verdieping']))
{
$verdieping = $_POST['verdieping'];
if (in_array('begane_grond', $_POST['verdieping'])) { $verdieping_0 = 'checked'; }
if (in_array('1e_verdieping', $_POST['verdieping'])) { $verdieping_1 = 'checked'; }
if (in_array('2e_verdieping', $_POST['verdieping'])) { $verdieping_2 = 'checked'; }
if (in_array('hoger', $_POST['verdieping'])) { $verdieping_3 = 'checked'; }
foreach ($verdieping as $etage)
{
$selVerdieping .= $etage . ', ';
}
$selVerdieping = substr($selVerdieping, 0, -2);
$selVerdieping = str_replace('begane_grond', 'Begane grond', $selVerdieping);
$selVerdieping = str_replace('1e_verdieping', '1e verdieping', $selVerdieping);
$selVerdieping = str_replace('2e_verdieping', '2e verdieping', $selVerdieping);
$selVerdieping = str_replace('hoger', 'Hoger', $selVerdieping);
}
$opmerkingen = htmlentities(trim(strip_tags($_POST['opmerkingen'])));
// persoonlijke gegevens
$aanhef = $_POST['aanhef'];
if (isset($_POST['aanhef']))
{
if ($_POST['aanhef'] == 'dhr') { $aanhef_dhr = 'checked'; }
if ($_POST['aanhef'] == 'mevr') { $aanhef_mevr = 'checked'; }
}
$voornaam = htmlentities(trim(strip_tags($_POST['voornaam']))); // verplicht
$tussenvoegsel = htmlentities(trim(strip_tags($_POST['tussenvoegsel'])));
$achternaam = htmlentities(trim(strip_tags($_POST['achternaam']))); // verplicht
$vorm = $_POST['vorm']; // particulier of zakelijk
if (isset($_POST['vorm']))
{
if ($_POST['vorm'] == 'particulier') { $vorm_ja = 'checked'; }
if ($_POST['vorm'] == 'zakelijk') { $vorm_nee = 'checked'; }
}
$bedrijfsnaam = htmlentities(trim(strip_tags($_POST['bedrijfsnaam'])));
$email = trim(strip_tags($_POST['email'])); // verplicht
$telefoon = htmlentities(trim(strip_tags($_POST['telefoon']))); // verplicht
$straat_nr = htmlentities(trim(strip_tags($_POST['straat_nr']))); // verplicht
$postcode = htmlentities(trim(strip_tags($_POST['postcode']))); // verplicht
$plaatsnaam = htmlentities(trim(strip_tags($_POST['plaatsnaam']))); // verplicht
$provincie = htmlentities(trim(strip_tags($_POST['provincie'])));
$land = $_POST['land'];
if (isset($_POST['land']))
{
if ($_POST['land'] == 'nederland') { $land_nl = 'checked'; }
if ($_POST['land'] == 'belgie') { $land_b = 'checked'; }
if ($_POST['land'] == 'duitsland') { $land_de = 'checked'; }
if ($_POST['land'] == 'anders') { $land_anders = 'checked'; }
}
$contactvorm = $_POST['contactvorm'];
if (isset($_POST['contactvorm']))
{
if ($_POST['contactvorm'] == 'email') { $contact_email = 'checked'; }
if ($_POST['contactvorm'] == 'telefoon') { $contact_telefoon = 'checked'; }
}
$errors = array();
$regex_voornaam = '/^[a-z -]+$/ismU';
if (empty($voornaam) || strlen($voornaam) == 1 || preg_match($regex_voornaam, $voornaam) === 0)
{
$voornaam_brdr = 'border-color:#FF0000;';
$errors[] = 'Geen geldige voornaam ingevuld!';
}
$regex_achternaam = '/^[a-z -]+$/ismU';
if (empty($achternaam) || strlen($achternaam) == 1 || preg_match($regex_achternaam, $achternaam) === 0)
{
$achternaam_brdr = 'border-color:#FF0000;';
$errors[] = 'Geen geldige achternaam ingevuld!';
}
function checkmail($mail)
{
$email_host = explode("@", $mail);
$email_host = $email_host['1'];
$email_resolved = gethostbyname($email_host);
if ($email_resolved != $email_host && eregi("^[0-9a-z]([-_.~]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]{2,4}$",$mail))
$valid = 1;
return $valid;
}
if (empty($email) || !checkmail($email))
{
$email_brdr = 'border-color:#FF0000;';
$errors[] = 'Geen geldig e-mailadres ingevuld!';
}
if (empty($telefoon) || strlen($telefoon) != 10 || !ctype_digit($telefoon))
{
$telefoon_brdr = 'border-color:#FF0000;';
$errors[] = 'Geen geldig telefoonnummer ingevuld!';
}
$regex_straat_nr = '/^[a-z0-9 -\']+$/ismU';
if (empty($straat_nr) || strlen($straat_nr) < 4 || strlen($straat_nr) > 40 || preg_match($regex_straat_nr, $straat_nr) === 0)
{
$straat_nr_brdr = 'border-color:#FF0000;';
$errors[] = 'Geen geldige straatnaam ingevuld!';
}
$regex_postcode = '/^[1-9]{1}[0-9]{3}(\s|)[a-z]{2}$/ismU';
if (empty($postcode) || strlen($postcode) < 6 || strlen($postcode) > 7 || preg_match($regex_postcode, $postcode) === 0)
{
$postcode_brdr = 'border-color:#FF0000;';
$errors[] = 'Geen geldige postcode ingevuld!';
}
$regex_plaatsnaam = '/^[a-z -\']+$/ismU';
if (empty($plaatsnaam) || strlen($plaatsnaam) < 3 || preg_match($regex_plaatsnaam, $plaatsnaam) === 0)
{
$plaatsnaam_brdr = 'border-color:#FF0000;';
$errors[] = 'Geen geldige plaatsnaam ingevuld!';
}
if (count($errors) >= 1)
{
$display_proces = 'block';
$proces = 'proces_fout';
}
else
{
$display_proces = 'block';
$proces = 'proces_goed';
// naam samenstellen
if (!empty($tussenvoegsel))
{
$naam = $voornaam.' '.$tussenvoegsel.' '.$achternaam;
}
else
{
$naam = $voornaam.' '.$achternaam;
}
// bevestigingsemail sturen
require_once('class.phpmailer.php');
$mail = new PHPMailer();
$mail->IsHTML(true);
$mail->From = 'info@johnszonwering.nl';
$mail->FromName = $naam;
$mail->AddAddress('info@johnszonwering.nl', 'John\'s Zonwering');
$mail->AddReplyTo($email, $voornaam);
$mail->Subject = "Nieuwe offerte-aanvraag!";
$body = file_get_contents('mailtje.html');
$body = eregi_replace("[\]", '', $body);
$body = str_replace("[datum]", date('d-m-Y'), $body);
$body = str_replace("[omschrijving]", nl2br($omschrijving), $body);
$body = str_replace("[type]", $selType, $body);
$body = str_replace("[aantal]", $aantal, $body);
$body = str_replace("[afmetingen]", nl2br($afmetingen), $body);
$body = str_replace("[kleur]", $kleur, $body);
$body = str_replace("[elektrische_bediening]", $el_bediening, $body);
$body = str_replace("[inclusief_installatie]", $incl_installatie, $body);
$body = str_replace("[verdieping]", $selVerdieping, $body);
$body = str_replace("[opmerkingen]", nl2br($opmerkingen), $body);
$body = str_replace("[aanhef]", $aanhef, $body);
$body = str_replace("[voornaam]", $voornaam, $body);
$body = str_replace("[tussenvoegsel]", $tussenvoegsel, $body);
$body = str_replace("[achternaam]", $achternaam, $body);
$body = str_replace("[vorm]", $vorm, $body);
$body = str_replace("[bedrijfsnaam]", $bedrijfsnaam, $body);
$body = str_replace("[email]", $email, $body);
$body = str_replace("[telefoon]", $telefoon, $body);
$body = str_replace("[straat_nr]", $straat_nr, $body);
$body = str_replace("[postcode]", $postcode, $body);
$body = str_replace("[plaatsnaam]", $plaatsnaam, $body);
$body = str_replace("[provincie]", $provincie, $body);
$body = str_replace("[land]", $land, $body);
$body = str_replace("[contactvorm]", $contactvorm, $body);
$mail->MsgHTML($body);
if(!$mail->Send())
{
echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
echo "";
}
}
}
?>
John's Zonwering / Offerte aanvragen.

Offerte Formulier
Let op! Alle velden met een (*) zijn verplicht om in te vullen.
|
if (count($errors) >= 1)
{
echo 'Oops.. er is iets mis gegaan ';
foreach ($errors as $error)
{
echo ''.$error.'';
}
}
else
{
echo 'Uw offerte-aanvraag is succesvol verzonden!';
}
?>
|
|
|