How to BUILD a contact form in a website using PHP

Discussion in 'PHP' started by pupuly, Nov 19, 2011.

  1. #1
    Actually m a beginner to PHP....:)
    n want to know how can we use PHP code in a html page to build a contact form ....so that it works....
    I used some of the codes posted in forums but...I want to know can we use a gmail account as a recipient email address.:confused: if yes then please help me out...if not then then what is the right way to build a contact form in a website so that the data of that form can be receive in a particular email id.:rolleyes:
     
    pupuly, Nov 19, 2011 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    28,899
    Likes Received:
    4,555
    Best Answers:
    123
    Trophy Points:
    665
    #2
    A contact form can be sent to any email address - it's not fussy about that.

    The form needs to have the "action" set to your php script
    The script then works through either the $_GET or $_POST variables and either builds up the string that will be the body of your email, saves to the database etc
    It can then use mail() to send the email to you

    Have you searched for contact form tutorial? It seems there are plenty of help: http://www.google.co.nz/search?q=php+contact+form+tutorial
     
    sarahk, Nov 19, 2011 IP
  3. kids

    kids Active Member

    Messages:
    411
    Likes Received:
    4
    Best Answers:
    2
    Trophy Points:
    68
    #3
    You can read some simple code about this before start to begin with this form type.
    - You can be spammed by bot through this form
    - Your mailbox can be full soon.

    So you need:
    - smtp mail protocol function
    - capcha code generator function
    - and your programing skill

    That's all.
     
    kids, Nov 20, 2011 IP
  4. kids

    kids Active Member

    Messages:
    411
    Likes Received:
    4
    Best Answers:
    2
    Trophy Points:
    68
    #4
    Ah, one more thing. As you want to use gmail as primary contact email, this case I currently don't try yet. With smtp protocol function I think you can do that because you can you smtp gmail account to send email. But I don't know how to do. Hehe
     
    kids, Nov 20, 2011 IP
  5. IndiaNIC

    IndiaNIC Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    absolutely right sarahk ... if you have any query you can easily search tutorial from google.... if you do practically it will help you to learn ... :)
     
    IndiaNIC, Nov 21, 2011 IP
  6. akbarul

    akbarul Peon

    Messages:
    57
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Thanks for this link. Let's go to the party .. . wowowo it's just search result, but I think it is enough.
     
    akbarul, Nov 23, 2011 IP
  7. sarahk

    sarahk iTamer Staff

    Messages:
    28,899
    Likes Received:
    4,555
    Best Answers:
    123
    Trophy Points:
    665
    #7
    Nobody is going to give a link and say this is absolutely the right one because you may need something different. Pointing you in the right direction is totally appropriate.
     
    sarahk, Nov 23, 2011 IP
  8. c4cyber

    c4cyber Well-Known Member

    Messages:
    1,040
    Likes Received:
    27
    Best Answers:
    1
    Trophy Points:
    150
    #8
    i agree with sarahk! even if someone will give you the exact link of tutorial/snippet, only you know if it fits to your requirements or not, so try to get used to search engines on your own, as its something we have to learn to learn other things on internet.
     
    c4cyber, Nov 23, 2011 IP