evolutionen
Büro für postheroisches Management GmbH
Friedrichstr. 133, 10117 Berlin-Mitte
Phone: ++49 (0) 30 – 4000 567 0
Fax: ++49 (0) 30 – 4000 567 22
// Standardfunktionen des Formulars
// !Hier nicht unbedingt ändern!
$MISSING = array();
$REQUEST = array();
$ERRORMESSAGE = "";
function checkRequest()
{
global $_REQUEST;
global $REQUEST;
global $MISSING;
foreach($REQUEST as $variable)
{
switch($variable[3])
{
case "array":
if($variable[1])
{
if(!is_array($_REQUEST[$variable[0]]) || (count($_REQUEST[$variable[0]])<1))
{
$MISSING[] = $variable[0];
}else
{
$empty = true;
foreach($_REQUEST[$variable[0]] as $value)
if(!empty($value))
$empty = false;
if($empty)
{
$MISSING[] = $variable[0];
};
};
};
break;
default:
if($variable[1] && empty($_REQUEST[$variable[0]]))
{
$MISSING[] = $variable[0];
};
};
};
if(count($MISSING) > 0)
{
return false;
}else
return true;
};
function renderMissing()
{
global $MISSING;
global $ERRORMESSAGE;
$missing = "";
foreach($MISSING as $variable)
{
if($missing != "")
$missing .= ", ";
$missing .= $variable;
};
if($missing != "")
{
return(str_replace("[VAR]", $missing, $ERRORMESSAGE));
}else
return false;
};
function renderRequest()
{
global $_REQUEST;
global $REQUEST;
global $MISSING;
$requestmessage = "";
foreach($REQUEST as $variable)
{
switch($variable[3])
{
case "array":
$textvalue = "";
foreach($_REQUEST[$variable[0]] as $value)
$textvalue .= $value . "\n";
$requestmessage .= str_replace("[VAR]", stripslashes($textvalue), $variable[2]);
break;
default:
$requestmessage .= str_replace("[VAR]", stripslashes($_REQUEST[$variable[0]]), $variable[2]);
};
};
return $requestmessage;
};
?>
// Konfiguration des Formulars
// | Name des Feldes | notwendig | Ausgabe in E-Mail | Typ
$REQUEST[] = array( "vorname", true, "Vorname: [VAR]\n");
$REQUEST[] = array( "name", true, "Name : [VAR]\n");
$REQUEST[] = array( "firma", true, "Firma : [VAR]\n");
$REQUEST[] = array( "email", true, "email : [VAR]\n"."\n");
$REQUEST[] = array( "notiz", true, "Notiz \n[VAR]\n");
$REQUEST[] = array( "kontakt", true, "Kontaktmöglichkeit \n[VAR]\n" , "array");
$REQUEST[] = array( "zeitraum", true, "Kontaktzeitraum: [VAR]\n");
$ERRORMESSAGE = 'Please complete all the fields: [VAR]';
?>
// Versenden der Mail falls vollstädnige Daten und "Submit"
if($_REQUEST["submit"] && checkRequest())
{
$mail_subject = "Coachinganfrage";
$mail_body = "Anfrage vom " . date("d.m.Y H:i ", time()) . "\n";
$mail_body .= renderRequest();
$mail_to = "witzer@evolutionen.de";
// $mail_to = "axel@zwo-null.de";
$mail_from = "webformular@evolutionen.de";
ini_set("sendmail_from", $mail_from);
mail($mail_to, $mail_subject, $mail_body, "Reply-To: ".$mail_from."\r\n" . "X-Mailer: ambaar artmedia","-f" . $mail_from);
?>
Thank you very much for your message. We will
contact you without delay.
}else
{
?>
// Ausgabe der Fehlermeldung
if(($missing = renderMissing()) !== false)
{
echo $missing;
};
?>