Ich habe das Kontaktformular mit HTML und PHP erstellt. Außerdem kommt die Mail korrekt zur Mail-ID. Aber nach der Erfolgsmeldung wird es auf die Seite form.php
umleiten kann mir bitte jemand helfen. Es ist das erste Mal, dass ich versuche, eine Website zu erstellen.Wie erhalten Sie die Erfolgsmeldung nach dem Absenden des Kontaktformulars auf derselben Seite?
Hier ist mein Code für Kontaktformular:
<form method="post" action="form.php">
<input name="name" required="required" placeholder="Your Name">
<input name="email" type="email" required="required" placeholder="Your Email">
<div class="clearfix"> </div>
<textarea name="message" cols="20" rows="5" required="required" placeholder="Message"></textarea>
<div class="submit">
<input id="submit" name="submit" type="submit" value="Submit">
</div>
</form>
hier ist mein form.php
:
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$from = 'From: agriindiaexp.com';
$to = '[email protected]';
$subject = 'Email Inquiry';
$body = "From: $name\n E-Mail: $email\n Message:\n $message";
if ($_POST['submit']) {
if (mail ($to, $subject, $body, $from)) {
$success = "Message successfully sent";
} else {
$success = "Message Sending Failed, try again";
}
}
?>
Bitte mir helfen.
Check: [http://stackoverflow.com/questions/5826784/how-do-i-make-a-php-form-that-submits-to-self](http://stackoverflow. com/questions/5826784/how-do-i-make-a-php-form-that-submits-to-self) – Rohit
Wenn Sie es ohne Seitenaktualisierung wollen, dann überprüfen Sie [http://www.codingcage.com/2015 /06/submit-php-form-without-page-refresh-jquery-ajax.html](http://www.codingcage.com/2015/06/submit-php-form-without-page-refresh-jquery- ajax.html) – Rohit
oder '