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

Contactform validation + more

  • # January 6, 2010 at 2:05 pm

    Hi guys,

    I’m making a contact form, and i want in to be validated on submission page. I mean, that there’s some required fields, and if the person who wants to contact me, doesn’t write anything in the fields, a message like this shows up over the contact field: "You need to fill this one out."

    If you can put it into my code it would be fine :)



    Dit navn:

    E-mail: *

    Emne: *

    Kategori: *

    Besked: *

    * = Skal udfyldes

    I’ve also tried to make my own "send.php", but i dont think it work. I would like, if someone would check it, and eventually tell me what i need.


    < ?php $navn = $_POST ['navn']; // navnet på afsenderen $from = $_POST ['mail']; // afsenderens mail $subject = $_POST ['emne']; // emne $category = $_POST ['kategori']; //Find ud af mere $message = $_POST ['besked']; // Beskeden $body = ""; $body .= "Navn:"; $body .= $navn; $Body .= "n"; $body .= "E-mail:"; $body .= $from; $Body .= "n"; $body .= "Besked:"; $body .= $message; // Send mailen mail ($category, $subject, $body); ?>

    Hopefull somebody has a solution – and have a nice day! :)


    # January 6, 2010 at 6:15 pm

    There are a LOT of PHP based contact form tutorials online… I know that Chris has at least one in the Screencasts section of the site. Rather than simply having someone write the code for you, I’d suggest working through a tutorial so you actually understand what you are doing. If you have issues, you can then post here.

    # January 7, 2010 at 7:35 am

    I have seen a lot of them, but not many of them have the validation i’m looking for. And the one of Chris’s, he just put a code in, and i don’t really know what it means. But i’ll try again…

    # January 7, 2010 at 12:25 pm

    I’ve studied it a bit more, and finally found a soloution :)

    # January 7, 2010 at 5:24 pm

    If you have used someone elses code you should post the code in here so future people can get ideas and help from it.

    # January 8, 2010 at 3:19 pm

    Well, it’s just the validation code from Chris’s article: "Creating a unique contact form" (or something like that…)
    I dont know what all that js means, i just tried it, and it worked.

Viewing 6 posts - 1 through 6 (of 6 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