Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

How do I create a contact form?

  • 25-08-2010 8:55pm
    #1
    Registered Users, Registered Users 2 Posts: 383 ✭✭


    Hi guys, I have built a number of simple html websites mainly using the design tab of dreamweaver and they all work very well. At the minute I am doing a redesign for a friend of mine who wants a contact form on their site and not just a mailto link which is what I usually use because of my lack of knowledge!


    I have done a bit of research and everything seems to be pointing me towards a PHP contact form but I haven't a clue where to start. I have a very very small understanding of scripting and I usually learn things by finding something that works and editing it for what I want it to do.

    So I am wondering if someone could point me in the right direction to either download a good php contact form script that I could edit or suggest a link for a good online tutorial that I could follow. I have done some searching myself but am aware I could easily get a dodgy script so hoping you could point in the right direction.

    I don't expect you guys to give up the code you developed yourself but any help would be greatly appreciated. Thanks!
    Tagged:


Comments

  • Closed Accounts Posts: 285 ✭✭Plebs


    lostdesign wrote: »
    Hi guys, I have built a number of simple html websites mainly using the design tab of dreamweaver and they all work very well. At the minute I am doing a redesign for a friend of mine who wants a contact form on their site and not just a mailto link which is what I usually use because of my lack of knowledge!


    I have done a bit of research and everything seems to be pointing me towards a PHP contact form but I haven't a clue where to start. I have a very very small understanding of scripting and I usually learn things by finding something that works and editing it for what I want it to do.

    So I am wondering if someone could point me in the right direction to either download a good php contact form script that I could edit or suggest a link for a good online tutorial that I could follow. I have done some searching myself but am aware I could easily get a dodgy script so hoping you could point in the right direction.

    I don't expect you guys to give up the code you developed yourself but any help would be greatly appreciated. Thanks!

    Use jQuery on client side to filter/prompt user.

    Send a message from your browser to PHP like this:

    contactForm.php:
    <html>
    <form>
    Email: <input id="email"></input>
    </form>
    </html>
    
    <script>
    $('#email').click(function(){send2server();});
    function send2server(){
       var email=$('#email').val();
       var url="http://www.myserver.com/formHandler.php?email="+email;
    
       //open the url using XMLHttpWebRequest
    }
    </script>
    

    Use PHP on the server side to verify and process the information sent.

    formHandler.php:
    <?php
    //grab the variable:
    $email=$_GET['email'];
    
    //make sure $email is valid here
    if(isValidEmail($email)){
       //valid email address: store in database, etc.
       storeInDatabase($email);
    }
    //etc.
    
    ?>
    


  • Registered Users, Registered Users 2 Posts: 383 ✭✭lostdesign


    Thanks Plebs, will give it a shot!


Advertisement