Ich habe eine HTML-Seite, die ein Kontaktformular hat. Ich habe noch kein Captcha drauf, aber ich versuche zu verstehen, warum dieser Code nicht funktioniert, bevor ich darauf eingehe. So hat mein index.html dieses Formular:Versucht, Mail mit PHP zu senden, was ist falscher Code?
<form id="quote-form" action="inc/sendmail.php" method="post">
<div class="sec-title text-center">
<h1>Request for Quote</h1>
<span class="border center"></span>
</div>
<div class="row">
<div class="col-md-12">
<input type="text" name="name" value="" placeholder="Your Name*" required="">
<input type="email" name="email" value="" placeholder="Your Mail*" required="">
<input type="text" name="phone" value="" placeholder="Your Phone*" required="">
<select class="selectmenu" name=message>
<option selected="selected">Select Service</option>
<option value="Need Quote on a product Alpha</option>
<option>Other</option>
</select>
<button class="thm-btn bg-clr1" type="submit">Get a Quote</button>
</div>
</div>
</form>
hat mein sendmail.php diesen Code:
<?php
if(isset($_POST['submit'])){
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$phone = $_POST['phone'];
$formcontent="From: $name \n Message: $message \n Email:$email \n Phone:$phone";
$recipient = "[email protected]";
$subject = "Website Contact Form";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Mail Sent. Thank you, we will contact you shortly.";
}
?>
erstens sehen, erlaubt Ihnen Ihre Hosting-Firma, Post zu senden? 2.: Gmail nimmt es sogar an oder wirft es einfach weg? – Forbs
Welchen Fehler sehen Sie? –
Sie überprüfen: 'if (isset ($ _ POST ['submit'])) aber Ihr Formular hat kein Element namens" submit ", also wird die Bedingung im Grunde nie erfüllt werden –