Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End PHP + jQuery Contact Form – Recommendation

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #26210
    marcott
    Member

    Hello everyone,

    I am building a contact form as well as a registration form to be included in a WordPress template. So far the form is styled and the jQuery validation is working correctly. What I would like the form to do when it is submitted is do the back end validation, email the info to a set email address and then replace the form with a success message.

    Can anyone recommend a good tutorial? I have googled it but I seem to be swimming in a sea of contact forms.

    Thanks.

    #64578
    TheDoc
    Member
    #64583
    marcott
    Member

    Thanks for the link.

    I used the script and it passes on the info fine but I am wondering how I can go about displaying the success or failure message on the original contact page rather than having a new page loaded.

    User fills out info -> user clicks submit -> info is validated -> form disappears or fades out and is replaced by the success or failure message

    #64586
    TheDoc
    Member

    Find this at the bottom:

    Code:
    if(mail($to, $subject, $message, $headers))
    {
    $result = “Thank you.
    I will get back to you very soon.
    “;
    }
    else
    {
    $result = “Sorry: An error occured, please try again later.”;
    }
    }

    And replace it with something like this:

    Code:
    $result = “../contact-success.php”;
    $errorpage = “../contact-error.php”;

    if(mail($to, $subject, $message, $headers))
    {
    header(“Location: ” . $result);
    }
    else
    {
    header(“Location: ” . $errorpage);
    }
    }

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