'; print_r($_POST); echo ''; */ $input = array(); $input['sex'] = 'Herr'; $input['name'] = ''; $input['forename'] = ''; $input['company'] = ''; $input['street'] = ''; $input['zip'] = ''; $input['city'] = ''; $input['country'] = ''; $input['phone'] = ''; $input['mail'] = ''; $input['request'] = ''; $input_interests = array(); $interests = array( 'Newsletter', 'Fanartikel', 'Events', 'Fahrercoaching/Instruktor', 'Renneinsätze', 'Rennfahrzeuge/Simulator', 'Sponsoring', 'Medienarbeit', 'Rennsport-Zubehör', 'Beratung' ); if (isset($_POST['name'])) { //form has been sent, so proccess it $input['sex'] = $_POST['title']; $input['name'] = $_POST['name']; $input['forename'] = $_POST['forename']; $input['company'] = $_POST['company']; $input['street'] = $_POST['street']; $input['zip'] = $_POST['zip']; $input['city'] = $_POST['city']; $input['country'] = $_POST['country']; $input['phone'] = $_POST['phone']; $input['mail'] = $_POST['mail']; if(isset($_POST['comment'])) $input['request'] = $_POST['comment']; if(isset($_POST['interest'])) $input_interests = $_POST['interest']; $names = array( 'sex' => 'Anrede', 'name' => 'Nachname', 'forename' => 'Vorname', 'company' => 'Firma', 'street' => 'Straße', 'zip' => 'PLZ', 'city' => 'Ort', 'country' => 'Land', 'phone' => 'Telephon', 'mail' => 'E-Mail', 'request' => 'sonstige Anfrage:' ); if(correctForm($input['name'], $input['forename'], $input['mail']) == true) sendMail(); else sendError(); } //check the inputs function correctForm($name, $forename, $mail){ if(strlen(trim($name)) < 2) return false; if(strlen(trim($forename)) < 2) return false; if(!preg_match( "/^([a-zA-Z0-9])+([a-zA-Z0-9._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9._-]+)+$/", trim($mail))) return false; return true; } //send the mail function sendMail(){ global $input; global $input_interests; global $names; $mail_html = ' '; $mail_html .= 'Neue Anfrage von der Website www.mzeiner.at:
'; $mail_html .= ''; $mail_text = ' Neue Anfrage von der Website www.mzeiner.at: ============================================ '; foreach ($input as $index => $value) { $mail_html .= ' '; $mail_text .= $names[$index].': '.$value.' '; } $mail_html .= ''; $mail_html .= '
'.$names[$index].' '.$value.'
Interessen: 
    '; $mail_text .= 'Interessen: '; if(count($input_interests > 0)){ foreach ($input_interests as $interest) { $mail_html .= '
  • '.$interest.'
  • '; $mail_text .= $interest; } } $mail_html .= '
'; $from = "\"mzeiner\" "; //$to = 'nathalie.holub@mquadr.at'; //$toFull = '"Markus Zeiner" '; $to = 'office@mzeiner.at'; $toFull = '"Markus Zeiner" '; $subject = "Anfrage von www.mzeiner.at"; $mime_boundary = "----=_NEXTPart_".md5 (mt_rand ()); $headers = "From: $from\r\n" . "To: $toFull\r\n" . "MIME-Version: 1.0\n" . "Content-Type: multipart/alternative;\n" . "\tboundary=\"{$mime_boundary}\""; $message = "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type: text/plain; charset=\"ISO-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $mail_text ."\r\n" . "--{$mime_boundary}\n" . "Content-Type: text/html; charset=\"ISO-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $mail_html . "\r\n" . "--{$mime_boundary}--"; mail ($to, $subject, $message, $headers); } //an error occured, inform the user function sendError(){ global $error; $error = 'Es wurde nicht alle Felder korrekt ausgefüllt - bitte überprüfen Sie Ihre Angaben und versuchen Sie es nochmals.'; } ?>