Home › Forums › Porto – Responsive HTML5 Template › Wrong Message Contact-Form
- This topic has 2 replies, 2 voices, and was last updated 10 years, 8 months ago by
NosePoke123. This post has been viewed 2885 times
-
AuthorPosts
-
November 3, 2014 at 3:51 pm #10004766
NosePoke123
ParticipantHello,
I’ve got a problem with the contact form. When I enter the contact form data correctly and submit the form, I receive the error message at the top of the form. The problem is: The e-mail is successfully send to my adress. How can I fix the problem so I get the right message if the mail is send or not?!
Here is my contact form at the page “kontakt.php”:
<div class="alert alert-success hidden" id="contactSuccess"> Die Nachricht wurde <strong>erfolgreich</strong> an uns übermittelt. </div> <div class="alert alert-danger hidden" id="contactError"> <strong>Fehler:</strong> Die Nachricht konnte nicht übermittelt werden. Bitte versuchen Sie es erneut oder kontaktieren Sie uns per Telefon. </div> <h2 class="short">Kontaktformular</h2> <form id="contactForm" action="php/contact-form.php" method="POST"> <div class="row"> <div class="form-group"> <div class="col-md-6"> <label>Ihr Name *</label> <input type="text" value="" data-msg-required="Bitte geben Sie ihren Namen an." maxlength="100" class="form-control" name="name" id="name" required> </div> <div class="col-md-6"> <label>Ihre E-Mail Adresse *</label> <input type="email" value="" data-msg-required="Bitte geben Sie ihre E-Mail Adresse an." data-msg-email="Bitte geben Sie eine gültige E-Mail Adresse an." maxlength="100" class="form-control" name="email" id="email" required> </div> </div> </div> <div class="row"> <div class="form-group"> <div class="col-md-12"> <label>Betreff *</label> <input type="text" value="" data-msg-required="Bitte geben Sie einen Betreff an." maxlength="100" class="form-control" name="subject" id="subject" required> </div> </div> </div> <div class="row"> <div class="form-group"> <div class="col-md-12"> <label>Nachricht *</label> <textarea maxlength="5000" data-msg-required="Bitte geben Sie eine Nachricht ein." rows="10" class="form-control" name="message" id="message" required></textarea> </div> </div> </div> <div class="row"> <div class="col-md-12"> <input type="submit" value="Nachricht senden" class="btn btn-primary btn-lg" data-loading-text="Bitte warten..."> </div> </div> </form>
And here is my “contact-form.php”:
<?php /* Name: Contact Form Written by: Okler Themes - (http://www.okler.net) Version: 3.2.0 */ session_cache_limiter('nocache'); header('Expires: ' . gmdate('r', 0)); header('Content-type: application/json'); // Enter your email address below. $to = '[email protected]'; $subject = $_POST['subject']; if(isset($_POST['email'])) { $name = $_POST['name']; $email = $_POST['email']; $fields = array( 0 => array( 'text' => 'Name', 'val' => $_POST['name'] ), 1 => array( 'text' => 'Email address', 'val' => $_POST['email'] ), 2 => array( 'text' => 'Message', 'val' => $_POST['message'] ) ); $message = ""; foreach($fields as $field) { $message .= $field['text'].": " . htmlspecialchars($field['val'], ENT_QUOTES) . "<br>\n"; } $headers = ''; $headers .= 'From: ' . $name . ' <' . $email . '>' . "\r\n"; $headers .= "Reply-To: " . $email . "\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=UTF-8\r\n"; if (mail($to, $subject, $message, $headers)){ $arrResult = array ('response'=>'success'); } else{ $arrResult = array ('response'=>'error'); } echo json_encode($arrResult); } else { $arrResult = array ('response'=>'error'); echo json_encode($arrResult); } ?>
November 4, 2014 at 10:20 am #10004778Support
KeymasterThis reply has been marked as private.November 4, 2014 at 10:54 am #10004783NosePoke123
ParticipantHello,
excuse me, that was my fault that I don’t inform you about the solved problem!
In the late night I’ve updated the theme to the newest version and now the correct message is displayed. Thank you very much for the support.
-
AuthorPosts
This topic is marked as "RESOLVED" and can not rceive new replies.