Forums

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

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #166685
    charlie
    Participant

    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>
        &lt;h5&gt;Message sent on: &lt;/h5&gt;
        $todayis
        &lt;h3&gt;Thank you $name !&lt;/h3&gt;
        Your request for a catalog was submitted.&lt;br /&gt;
           Thank you for contacting us.
    </div>
    END;
    
    ?&gt;
    
    #166790
    charlie
    Participant

    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.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.