I am getting an error that says “Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request.Please contact the server administrator, and inform them of the time the error occurred, and anything you might have done that may have caused the error.More information about this error may be available in the server error log.”
I have MS (multiple sclerosis) for almost 20 yrs now. It has been progressing so much and my memory isn’t quite right all the time now. I just want to get this done for my son. Sorry for all the troubles.
this is a live link to his website http://leggacysoccer.com
this is the contact form html
<div class="container">
<form id="contact-form" method="post" action="contact.php" role="form">
<div class="messages"></div>
<div class="controls">
<div class="row">
<div class="col-sm-4">
<div class="form-group">
<label for="form_name">Name *</label>
<input id="form_name" type="text" name="surname" class="form-control" placeholder="Please enter your name *" required="required" data-error="name is required.">
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-sm-4">
<div class="form-group">
<label for="form_email">Email *</label>
<input id="form_email" type="email" name="email" class="form-control" placeholder="Please enter your email *" required="required" data-error="Valid email is required.">
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-sm-4">
<div class="form-group">
<label for="form_phone">Phone</label>
<input id="form_phone" type="tel" name="phone" class="form-control" placeholder="Please enter your phone number">
<div class="help-block with-errors"></div>
</div>
</div>
</div>
</div>
<div class="clearfix"></div>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label for="form_message">Message *</label>
<textarea id="form_message" name="message" class="form-control" placeholder="Message for me *" rows="4" required="required" data-error="send a message."></textarea>
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-md-12">
<input type="submit" class="btn btn-warning btn-send" value="Send message">
</div>
</div>
<div class="row">
<div class="col-md-12">
<p class="text-muted"><strong>*</strong> These fields are required.</p>
</div>
</div>
</form>
</div>
this is contact.php
<?php
// configure
$from = 'contact form <mlegg10.@gmail.com>';
$sendTo = 'contact form <mlegg10.@gmail.com>';
$subject = 'New message from contact form';
$fields = array('name' => 'Name', 'surname' => 'Surname', 'phone' => 'Phone', 'email' => 'Email', 'message' => 'Message'); // array variable name => Text to appear in the email
$okMessage = 'Contact form successfully submitted. Thank you, I will get back to you soon!';
$errorMessage = 'There was an error while submitting the form. Please try again later';
// let's do the sending
try
{
$emailText = "You have new message from contact form";
foreach ($_POST as $key => $value) {
if (isset($fields[$key])) {
$emailText .= "$fields[$key]: $value\n";
}
}
$headers = array('Content-Type: text/html; charset="UTF-8";',
'From: ' . $from,
'Reply-To: ' . $from,
'Return-Path: ' . $from,
);
mail($sendTo, $subject, $emailText, implode("\n", $headers));
$responseArray = array('type' => 'success', 'message' => $okMessage);
}
catch (\Exception $e)
{
$responseArray = array('type' => 'danger', 'message' => $errorMessage);
}
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
$encoded = json_encode($responseArray);
header('Content-Type: application/json');
echo $encoded;
}
else {
echo $responseArray['message'];
}
$(document).ready(function() {
$("#submit-button").on('click', function(e) {
e.preventDefault(); // Prevent form submission
// you would need to set the following values from your form fields
var name = $("#form_name").val();
var email = $("#form_email").val();
var phone = $("#form_phone").val();
var message = $("#form_message").val();
var dataString = 'surname='+ name + '&email=' + email + '&phone=' + phone + '&message=' + message;
$.ajax({
type: "POST",
url: "contact.php",
data: dataString,
success: function() {
$(".messages").html("Thank you for contacting me. I will be in touch soon.").css("visibility", "visible");
$("#submit-button").trigger("reset")
$('.messages').fadeTo( "slow", 1 ).fadeTo(3000, 0);
}
});
});
});
this is the contact.js
$(function () {
$('#contact-form').validator();
$('#contact-form').on('submit', function (e) {
if (!e.isDefaultPrevented()) {
var url = "contact.php";
$.ajax({
type: "POST",
url: url,
data: $(this).serialize(),
success: function (data)
{
var messageAlert = 'alert-' + data.type;
var messageText = data.message;
var alertBox = '<div class="alert ' + messageAlert + ' alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>' + messageText + '</div>';
if (messageAlert && messageText) {
$('#contact-form').find('.messages').html(alertBox);
$('#contact-form')[0].reset();
}
}
});
return false;
}
})
});
$(document).ready(function() {
$("#submit-button").on('click', function(e) {
e.preventDefault(); // Prevent form submission
// you would need to set the following values from your form fields
var name = $("#contact-form").val();
var email = $("#form_email").val();
var phone = $("#form_phone").val();
var message = $("#form_message").val();
var dataString = 'surname='+ name + '&email=' + email + '&phone=' + phone + '&message=' + message;
$.ajax({
type: "POST",
url: "contact.php",
data: dataString,
success: function() {
$(".messages").html("Thank you for contacting me. I will be in touch soon.").css("visibility", "visible");
$("#submit-button").trigger("reset")
$('.messages').fadeTo( "slow", 1 ).fadeTo(3000, 0);
}
});
});
});