- This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
- The forum ‘JavaScript’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › JavaScript › Javascript and PHP Form Not Validating or Sending Email
I tried to add extra validation fields to the form. Now it no longer validates or sends the email via the PHP script.
PHP script is here. Linking didn’t work. I’ll add code below.
See CodePen for HTML and Javascript.
Any help is appreciated.
Thank you,
Charlie
<?php
$sjRecip = '[email protected]' ;
// \n = line break for UNIX
// \r = line break for Windows
// " " = Space
$name = $_POST['name'];
$address = $_POST['address'];
$city = $_POST['city'];
$state = $_POST['state'];
$zip = $_POST['zip'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$todayis = date("l, F j, Y, g:i a") ;
$subject = 'SMYTH - We Buy Gold - Contact Form' ;
$headers = 'From: ' . $email . "\r\n" .
'Reply-To: ' . $email . "\r\n" .
'X-Mailer: PHP/' . phpversion();
$message = "\r\n" . "SENDER: " . $name . "\r\n\r\nEMAIL: " . $email . "\r\n\r\nPHONE: " . $phone . "\r\n\r\nADDRESS: " .$address . "\r\n\r\nCITY: " .$city . "STATE:" .$state . "ZIP:" . $zip .
mail($sjRecip, $subject, $message, $headers, "-f$email");
echo <<<END
<!--Display a thank you message in the callback -->
<div>
<h5>Message sent on: </h5>
$todayis
<h3>Thank you $name !</h3>
Your request for a catalog was submitted.<br />
Thank you for contacting us.
</div>
END;
?>
I don’t have easy access to logs.
I thought the error would just be in the JS because I tried to modify an existing js by adding more fields to the validation process.
When the form is submitted there doesn’t seem to be any validation taking place.