GLAMPINGCARD

Bestellen Sie Sofort kostenlos Ihre GlampingCard

Dankt

Das Formular wird in einem guten Zustand erhalten.
"; //UW GEGEVENS ("Naam Invulveld", "variabele invulveld", "soort", "Options", "required", "Melding die zichtbaar is indien required"); //soort = line - chackbox - radio - field //options kan zijn bij radio {ja|ja}{nee|nee} / of bij chackbox{Zee|zee}{Rivier|rivier}{Meer|meer}{Bos|bos}{Bergen|bergen}{Landelijk|landelijk} //required = * voor required $fields[] = array("Name", "naam", "line", "", "", ""); $fields[] = array("Adresse", "adres", "line", "", "", ""); $fields[] = array("Residentz", "plaats", "line", "", "", ""); $fields[] = array("Postleitzahl", "postcode", "line", "", "", ""); $fields[] = array("Land", "land", "line", "", "", ""); $fields[] = array("E-mail", "email", "line", "email", "*", "Bitte geben Sie eine gültige E-Mail-Adresse."); // ################ EINDE CONFIG ########################################################## // ####################################################################################### $errorPointer = ($posError == "above") ? "↓ " : "↑ "; function spaces($num, $fill=" "){ $foo=""; for ($i=0; $i<$num; $i++) $foo.=$fill; return $foo; } function isValidEmail($addr){ if(preg_match("(^[-\w\.]+@([-a-z0-9]+\.)+[a-z]{2,4}$)i", $addr)) return true; else return false; } function jsCharCount(){ if ($GLOBALS['cfCharCountFunc'] != 1){ $html = "\n"; $GLOBALS['cfCharCountFunc'] = 1; return $html; } } // STRAT EVALUATIE unset($error); if ($_REQUEST['do']=="send"){ $error = false; $fromAddress = ""; $message = ""; foreach ($fields as $field){ if ($field[4] == "*"){ if ($field[3] == "email"){ if (!isValidEmail($_REQUEST[$field[1]])) $error[$field[1]] = $field[5]; }else{ if ($_REQUEST[$field[1]] == "" || $_REQUEST[$field[1]] == " " || $_REQUEST[$field[1]] == " ") $error[$field[1]] = $field[5]; } } } if ($error === false){ $message = $emailSubject." \n
"; for ($i = 0; $i < strlen($emailSubject); $i++) $message .= "*"; $message .= " \n\n
$msgDate:"."  ".date($dateFormat)."\n\n
"; foreach ($fields as $field){ if ($field[2] == "leegveld"){ $message .= "\n"; }else if ($field[2] == "kopje"){ $message .= "\n".$field[0]; }else{ $message .= "\n".$field[0].":"."  "; if ($field[3] == "email"){ $message .= "".$_REQUEST[$field[1]]."
"; $fromAddress = "From: ".$_REQUEST[$field[1]]; }else if ($field[2] == "checkbox" || $field[2] == "multiselect"){ $multi = ""; foreach ($_REQUEST[$field[1]] as $val){ $divider = ($multi != "") ? ", " : ""; $multi .= (isset($val) && $val != "") ? $divider.$val : ""; } $message .= "".$multi."
"; }else $message .= "".$_REQUEST[$field[1]]."
"; } $message .= ""; } $headers = $fromAddress . "\r\n"; $headers .= "Reply-To: ". $_REQUEST[$field[1]] . "\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=UTF-8\r\n"; mail($targetAddress, $emailSubject, $message, $headers); //echo "
$message
"; echo $txtThankyou; } } if ($error!==false){ $html = ""; // FORMULIER UITTEKENEN $html .= "
\n"; $html .= "
    \n"; foreach ($fields as $field){ $htmlError = ""; $htmlField = ""; if ($field[2] == "divider"){ $html .= "
  • ".$field[0].""; }else{ $html .= "
  • ".$field[0].$field[4]."
    \n
    "; } switch ($field[2]){ case "line": $htmlField = ""; if (isset($error[$field[1]])) $htmlError = "
    ".$errorPointer.$error[$field[1]]."
    "; $html .= ($posError == "above") ? $htmlError.$htmlField : $htmlField.$htmlError; break; case "header": echo "fff"; break; case "field": if (is_numeric($field[3])){ $attrVal = "cfCount('cf_".$field[1]."', 'cf_remchars_".$field[1]."', ".$field[3].")"; $attr = "onkeydown=\"$attrVal\" onkeyup=\"$attrVal\""; }else $attr = ""; $htmlField .= "\n"; if (is_numeric($field[3])){ $remChars = (isset($_REQUEST[$field[1]])) ? ($field[3] - strlen($_REQUEST[$field[1]])) : $field[3]; $htmlField .= jsCharCount()."
    $txtRemainingChars ".$remChars.""; } if (isset($error[$field[1]])) $htmlError .= "
    ".$errorPointer.$error[$field[1]]."
    "; $html .= ($posError == "above") ? $htmlError.$htmlField : $htmlField.$htmlError; break; case "radio": preg_match_all("/\{(.*?)\}/", $field[3], $foo); $options = $foo[1]; $i=1; foreach ($options as $opt){ $opt = explode("|", $opt); $label = $opt[0]; $value = (isset($opt[1])) ? $opt[1] : $opt[0]; $checked = ($_REQUEST[$field[1]] == $value) ? "checked" : ""; $htmlField .= "   "; $i++; } if (isset($error[$field[1]])) $htmlError .= "
    ".$errorPointer.$error[$field[1]]."
    "; $html .= ($posError == "above") ? $htmlError.$htmlField : $htmlField.$htmlError; break; case "checkbox": preg_match_all("/\{(.*?)\}/", $field[3], $foo); $options = $foo[1]; $i=1; foreach ($options as $opt){ $opt = explode("|", $opt); $label = $opt[0]; $value = (isset($opt[1])) ? $opt[1] : $opt[0]; $checked = ($_REQUEST[$field[1]][($i)] == $value) ? "checked" : ""; $htmlField .= "   "; $i++; } if (isset($error[$field[1]])) $htmlError .= "
    ".$errorPointer.$error[$field[1]]."
    "; $html .= ($posError == "above") ? $htmlError.$htmlField : $htmlField.$htmlError; break; case "select": preg_match_all("/\{(.*?)\}/", $field[3], $foo); $options = $foo[1]; $i=1; $htmlField .= "\n\n"; if (isset($error[$field[1]])) $htmlError .= "
    ".$errorPointer.$error[$field[1]]."
    "; $html .= ($posError == "above") ? $htmlError.$htmlField : $htmlField.$htmlError; break; case "multiselect": preg_match_all("/\{(.*?)\}/", $field[3], $foo); $options = $foo[1]; $i=1; $htmlField .= "\n\n"; if (isset($error[$field[1]])) $htmlError .= "
    ".$errorPointer.$error[$field[1]]."
    "; $html .= ($posError == "above") ? $htmlError.$htmlField : $htmlField.$htmlError; break; } $html .= "
  • \n"; } $html .= "
  •  
    * $txtMandatory
  • \n"; $html .= "
  •  
    \n"; $html .= "\n"; $html .= "
  • \n"; $html .= "\n"; echo $html; } /* ######################### EINDE FORMULIER ######################### ##################################################################### */ ?>