Last active
February 8, 2020 11:01
-
-
Save loschke/425ad9a1711cd611711844523c2aea84 to your computer and use it in GitHub Desktop.
Code Snippets zu Blogbeitrag http://live.sevenx.de/tutorial/php-kontakt-formular-mit-utf-8-als-email-verschicken-jquery-powered/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form id="form" action="form2email.php" method="post"> | |
<label for="name">Name</label> | |
<input id="name" name="name" size="25" type="text" /> | |
<label for="email">Email</label> | |
<input id="email" name="email" size="25" type="text" /> | |
<label for="betreff">Betreff</label> | |
<input id="betreff" name="betreff" size="25" type="text" /> | |
<label for="nachricht">Nachricht</label> | |
<textarea id="nachricht" cols="50" rows="6" name="nachricht"></textarea> | |
<input id="submit" name="submit" type="submit" value="Formular senden" /> | |
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Ausführen wenn Formular gesendet | |
if (isset($_POST["submit"])) | |
{ | |
// Sammeln der Formulardaten | |
$an = "meine@email.de"; | |
$name = $_POST['name']; | |
$email = $_POST['email']; | |
$betreff = $_POST['betreff']; | |
$nachricht = $_POST['nachricht']; | |
// Mailheader UTF-8 fähig machen | |
$mail_header = 'From:' . $email . "n"; | |
$mail_header .= 'Content-type: text/plain; charset=UTF-8' . "rn"; | |
// Nachrichtenlayout erstellen | |
$message = " | |
Name: $namen | |
Email: $emailn | |
Nachricht: $nachrichtn | |
"; | |
// Verschicken der Mail | |
mail($an, $betreff, $message, $mail_header ); | |
}; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment