Hi there I am not that well versed in PHP and need some help please. I have set up a contact form and that submits ok. Just that upon submission the visitor will be left with this ugly screen.
Ideally I would like them to be left as to where they were when they filled out the form.
The HTML for the code is:-
<div class="form-group">
<input class="form-control" id="name" name="name" placeholder="Your Name" type="text" required>
</div>
<div class="form-group">
<input class="form-control" id="email" name="email" placeholder="Email Address" type="email" required>
</div>
<div class="form-group">
<textarea class="form-control" id="message" name="massage" placeholder="Type your message here" rows="5" required></textarea>
</div>
<div id="contactFormResponse"></div>
<button id="cfsubmit" type="submit" class="btn btn-dark btn-block contact-submit">Say Hello</button>
</form>
The PHP is:-
//send the email
$result = '';
if (mail ($to, $subject, $body)) {
$result .= '<div class="alert alert-success alert-dismissible" role="alert">';
$result .= '<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>';
$result .= 'Thank You! I will be in touch';
$result .= '</div>';
echo $result;
die();
}
$result = '';
$result .= '<div class="alert alert-danger alert-dismissible" role="alert">';
$result .= '<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>';
$result .= 'Something bad happend during sending this message. Please try again later';
$result .= '</div>';
echo $result;
I hope someone could please help. Thanks JP