Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

How do I create a contact form?

  • 25-08-2010 08:55PM
    #1
    Registered Users, Registered Users 2 Posts: 384 ✭✭


    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: 384 ✭✭lostdesign


    Thanks Plebs, will give it a shot!


Advertisement