PHP Contact Us Page

Discussion in 'PHP' started by ThomasVasquez12, May 11, 2012.

  1. #1
    Can any body help me how to make Contact Us page in PHP..
    Can you provide me whole code of contact us page.

    Thanks:
     
    ThomasVasquez12, May 11, 2012 IP
  2. Yaldaram

    Yaldaram Member

    Messages:
    49
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #2
    There are various scripts out there. Just google it yourself.
     
    Yaldaram, May 15, 2012 IP
  3. downloadphpscripts

    downloadphpscripts Peon

    Messages:
    21
    Likes Received:
    1
    Best Answers:
    3
    Trophy Points:
    0
    #3
    Hi Thomas,

    A contact page in it's simplest form will have the code below:

    
    <?php
    if($_POST["action"] === "submit_contact")
    {
    $emailto = "youremail@youremail.com"; // Set this to the email you want to receive the contact form
    $subject = "New Contact Request"; // Set this to the subject line for the email
    
    $_POST["name"] = filter_var($_POST["name"], FILTER_SANITIZE_EMAIL); // Sanitize field input
    $_POST["email"] = filter_var($_POST["email"], FILTER_SANITIZE_EMAIL); // Sanitize field input
    $_POST["phone"] = filter_var($_POST["phone"], FILTER_SANITIZE_EMAIL); // Sanitize field input
    $_POST["comments"] = filter_var($_POST["comments"], FILTER_SANITIZE_EMAIL); // Sanitize field input
    
    $comments = "NAME: " . $_POST["name"] . "\n
    EMAIL: " . $_POST["email"] . "\n
    PHONE: " . $_POST["phone"] . "\n\n
    COMMENTS:\n" . $_POST["comments"] . "\n";
    
    $headers = "From: " . $_POST["email"] . "\r\n";
    $headers .= "X-Identification: ECS-Mk1-B\r\n";
    $headers .= "MIME-Version: 1.0\n";
    $headers .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n";
    $headers .= "Content-Transfer-Encoding: 7bit\n\n";
    $sendtheemail = mail($emailto, $subject, $comments . "\n\n", $headers);
    }
    ?>
    
    <form action="<?php echo $_SERVER["PHP_SELF"] ?>" name="contact_form" method="post">
    <input type="hidden" name="action" value="submit_contact" />
    <input type="text" name="name" /> Your Name<br />
    <input type="text" name="email" /> Your Email<br />
    <input type="text" name="phone" /> Your Phone<br /><br />
    Your Comments<br />
    <textarea name="comments" style="width:300px;height:100px;"></textarea>
    <input type="submit" name="submit_email" value="Send Email" />
    </form>
    
    PHP:
    This code will print out a form (that you can modify) and the php code at the top will process the email. Of course, you may want to add captcha for bot protection, etc.

    Hope this helps you out.
     
    downloadphpscripts, May 15, 2012 IP
  4. atozvision

    atozvision Peon

    Messages:
    78
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    search google for many stylish contact form php script
     
    atozvision, May 17, 2012 IP
  5. crownedprince

    crownedprince Greenhorn

    Messages:
    23
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    13
    #5
    Dowloadphpscripts has give a simple format, you can either use it or simply google for ready made one.
     
    crownedprince, May 17, 2012 IP
  6. ThomasVasquez12

    ThomasVasquez12 Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I am studying PHP from aonestudy.com it is very nice site for Free Tutorial..

    Thanks for PHP Email Code..
     
    ThomasVasquez12, May 31, 2012 IP
  7. ThomasVasquez12

    ThomasVasquez12 Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Dear Frnds,
    I am looking for connctivity with my sql. i have download mysql software form mysql site but i cant run that software. can any body help me for download MYSQL Software plzzzzzzzzzzzzzzzzzz... send me the link of MYSQL...

    Thanks:
     
    ThomasVasquez12, May 31, 2012 IP
  8. akhileshbc

    akhileshbc Active Member

    Messages:
    98
    Likes Received:
    1
    Best Answers:
    5
    Trophy Points:
    75
    #8
    I use WAMPserver. It would install PHP, MySQL, Apache, phpMyadmin, etc. in a single click.
     
    akhileshbc, Jun 1, 2012 IP