Get a free trial // Grow your CSS skills // Land your dream job

Form validation & Submission

  • # December 14, 2008 at 8:08 am

    hey everyone,

    I have a form script in PHP and it works well, but it does not validate the HTML Fields.

    I found on a site a javascript validation, it works well in test mode, which is before it is sent to the PHP script to email.

    I have the script starting like this for testing the javascript validator:


    without the validation I normally let the srcipt work.


    How can I get the validation to work and when it is all valid, it automatically posts to the contact php?

    within the javascript I have this piece of code:

    if (reason != “”) {
    alert(“Some fields need correction:n” + reason);
    return false;

    alert(“All fields are filled correctly”); //this is the part that says everything is done correctly
    return false;

    # December 14, 2008 at 8:31 am

    I got it to work…..

    I stupidly did not return it as true.

    it now works very well, now to implement it to my clients.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed