Copy link to clipboard
Copied
Somehow, I only updated the 2018 on the bottom of this website and the contact form is not processing the inquiry. I only see the line hour glass functioning but receive no email. I'm posting the link and code, please assist!
https://universalittechnologies.com/contacts.php
<form action="MailHandler.php" method="post" name="contact-form" id="contact-form">
<div class="contact-form-loader"></div>
<fieldset>
<label class="name">
<input type="text" name="name" placeholder="Name:" value="" data-constraints="@Required @JustLetters" />
<span class="empty-message">*This field is required.</span> <span class="error-message">*This is not a valid name.</span> </label>
<label class="email">
<input type="text" name="email" placeholder="E-mail:" value="" data-constraints="@Required @Email" />
<span class="empty-message">*This field is required.</span> <span class="error-message">*This is not a valid email.</span> </label>
<label class="phone">
<input type="text" name="phone" placeholder="Phone:" value="" data-constraints="@Required @JustNumbers" />
<span class="empty-message">*This field is required.</span> <span class="error-message">*This is not a valid phone.</span> </label>
<label class="message">
<textarea name="comments" id="comments" placeholder="Message:" data-constraints='@Required @Length(min=20,max=999999)'></textarea>
<span class="empty-message">*This field is required.</span> <span class="error-message">*The message is too short.</span> </label>
<div class="clear"></div>
<div class="g-recaptcha" data-sitekey="6LfNjP8SAAAAANIM61P8VDcFHRc_LJc0Tbk1TsGN"></div>
<div> <a href="#" class="btn" data-type="reset">Reset form</a> </div>
<div> <a href="#" class="btn" data-type="submit">Send e-mail</a> </div>
</fieldset>
<div class="modal fade response-message">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Modal title</h4>
</div>
<div class="modal-body"> You message has been sent! We will be in touch soon. </div>
</div>
</div>
</div>
</form>
<?php
$errors = array();
if(empty($_POST['name'])){
$errors[] = 'Please enter your name';
} else {
echo "";
}
if(empty($_POST['email'])){
$errors[] = 'Please enter your email';
} else {
echo "";
}
if(empty($_POST['comments'])){
$errors[] = 'Please enter your comments';
} else {
echo "";
}
$emailPattern = '/^[^@\s]+@([-a-z0-9]+\.)+[a-z]{2,}$/i';
$to = "service@universalittechnologies.com";
//$to ="atlnycdude23@gmail.com"; // ----> Use this $to email declation just in case in a emergency.
$subject = 'Sales Inquiries, Potential/ReturningCustomer Related Questions';
$from = 'Universal IT Technologies';
$name = safe(stripslashes( $_POST['name']) );
$email = safe($_POST['email'] );
$phone = safe($_POST['phone'] );
//$cname = safe ($_POST['cname']);
$comments = safe(stripslashes($_POST['comments']) );
$headers = "From: ". $from . "<" . $to. ">\r\n";
$headers .= "Reply-To: " . $email . "\r\n";
$headers .= "Return-path: ". $email;
$message .= "Name: " . $name . "\n";
$message .= "Email: " . $email . "\n\n";
$message .= "Phone Number: " . $phone . "\n\n\n";
//$message .= "Company Name: " . $cname . "\n\n\n\n";
$message .= "Comments: " . $comments . "\n\n\n\n\n\n\n\n";
if (count($errors) < 1){
mail($to,$subject,$message,$headers);
echo "Thank you so much for your Inquiry. I'm looking forward in serving you soon!";
} else {
echo "Please go back and enter the requested information";
}
function safe($string)
{
$pattern = "/\r|\n|\%0a|\%0d|Content\-Type:|bcc:|to:|cc:/i";
return preg_replace($pattern, '', $string);
}
?>
Copy link to clipboard
Copied
When things go south, check your code for errors.
Showing results for https://universalittechnologies.com/contacts.php - Nu Html Checker
Copy link to clipboard
Copied
It was working prior to the simple copyright date update.
Copy link to clipboard
Copied
Do you have a backup cop you can revert to?
Copy link to clipboard
Copied
The stray span tag and using a paragraph as a child of ul notwithstanding, one thing that I suggest would be to not use reserved words for field names (ie, name="name"). Append or prepend something to differentiate, like name="username" or name="nameFull". I can't swear that using a reserved word is killing this, but it's generally not good form (pun intended.)
V/r,
^ _ ^
Copy link to clipboard
Copied
I get this error
POST https://universalittechnologies.com/mail/MailHandler.php 404 (Not Found)