Grow your CSS skills. Land your dream job.

Contact Form Submit

  • # June 17, 2009 at 9:24 am

    Hello! i am a complete novice with PHP.. a lot of cut and pasting goes down!

    I can sort out a contact form, but they all refresh the entire screen when the ‘contact.php’ file is run on the submit button.

    What i want is just the form area to refresh as ‘message sent’. is this possible?

    The reason i ask is because i am putting together a band site, on which there will be a ‘subscribe to newsletter’ section which simply collects their email address and then forwards to my email address to be storred.. this is the simplest way i could think of, but if you have other ideas, please throw them out there!

    Thanks chaps
    Alex

    # June 17, 2009 at 3:44 pm

    You’ll want to put something like this in:

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

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

    # June 17, 2009 at 6:15 pm

    You want to use the jQuery Form plugin http://malsup.com/jquery/form/#getting-started

    Basically you add a script to your page as follows:

    Code:

    Where #myform is the id of your form and #mydiv is the id of the div you want to contain the message.

    # June 18, 2009 at 6:33 am

    very useful! thanks guys

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

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".