Hallo, ich bin Einsteiger und habe versucht, ein Mail.php mit Kontaktformular zu erstellen. Es funktioniert allerdings nicht. Kann mir jemand sagen, was ich falsch gemacht habe?:
Dazu folgendes Kontaktformular:
danke schon im Voraus!
PHP-Code:
<?php
$to = "service@domain.co";
$from = $_REQUEST['email'];
$name = $_REQUEST['name'];
$headers = "From: $from";
$subject = "Support Anfrage über die Website";
$fields = array();
$fields{"Fname"} = "First Name";
$fields{"Lname"} = "Last Name";
$fields{"email"} = "Email";
$fields{"Fname"} = "Subject";
$fields{"message"} = "Message";
$body = "Here is the message you got:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }
$send = mail($to, $subject, $body, $headers);
?>
HTML-Code:
<form action="mail.php" class="form-validation" autocomplete="on" method="post" id="cf"> <div class="row"> <div class="col-sm-6 col-xs-12"> <div class="single-input"> <input type="text" placeholder="Vorname*" name="Fname"> </div> <!-- /.single-input --> </div> <div class="col-sm-6 col-xs-12"> <div class="single-input"> <input type="text" placeholder="Nachname*" name="Lname"> </div> <!-- /.single-input --> </div> </div> <!-- /.row --> <div class="single-input"> <input type="email" placeholder="E-Mail-Adresse" name="email"> </div> <!-- /.single-input --> <!-- /.row --> <div class="single-input"> <input type="text" placeholder="Betreff" name="sub"> </div> <!-- /.single-input --> <textarea placeholder="Nachricht" name="message"></textarea> <button class="tran3s p-color-bg">Senden</button> </form>
Kommentar