Fri. Nov 1st, 2019

Host your Website

Read and learn

FatCow Plan for $3.15/mo. only

How To: Create a simple website contact form using PHP

1 min read



A tutorial to help solve the simple problem of having a contact form on your website. This tutorial walks you through creating a reliable PHP contact form which emails the form contents to your email account. The tutorial introduces web technologies such as HTML, CSS and PHP.

Adobe Dreamweaver CS5 is used throughout this tutorial, however the same result can be achieved using notepad or any other text editor.

For more informative tutorials check out my YouTube channel and for more info on web services check out http://ninefishmedia.com

48 thoughts on “How To: Create a simple website contact form using PHP

  1. I never did get an answer to the question but I did go on to find a great javascript / php form that didn't  have the security field but also had a phone number field… You know its really hard to find information on forms and the code to go with… let me know if you want the link for above said form…

  2. Thanks man, it was a very nice tut, however I've got one issue with my form… I have followed you step by step but the error message when it comes up is in green instead of red.. any help? i've got .fail and .success inline css.. thanks a lot 🙂

  3. I seem to have a problem with the incomming message. The letters with accent doesn't apear instead of them there is a question mark. I've already tried with this:    mail($to,utf8_encode($subject),utf8_encode($message)); but the ő/Ő, ű/Ű letters keep apearing as questionmarks. Can anyone lend me a hand here?

  4. G'day Ben, first thanks for the vid, Its a great start for me into contact forms and php… but I do have a question and hope you have the time to answer it…
    If I didn't want to use the security field what code would be use instead as well as the code  to make the contact form once filled and sent go back to the main page…
    Thanks in advance hope its not to much trouble…
    Kris

  5. Ben, if I created an html page, how would I link this to say, a "contact us" tab on the menu? Do I <href="contactus.php" it within my index.html source code?

    Thanks for the detailed tutorial btw. It really helped a lot.

  6. Warning: mail(): Failed to connect to mailserver at &quot;localhost&quot; port 25, verify your &quot;SMTP&quot; and &quot;smtp_port&quot; setting in php.ini or use ini_set() ii get this error and i dont know how to fix it

  7. Hi Ben,
    Everything works perfectly, thanks for the video.

    I have 1 problem tho, I'm trying to make the contact form work for people in Poland and this form doesn't support Eastern European symbols (in my case Polish symbols such as: ą, ę, ć, ł, etc.)

    Any advice in regard to my problem?
    Thanks

  8. I'm having the same issue as everyone else here has mention??
    I see no answer. glad I'm not the only one having a problem. 
    ALSO you are moving and typing a bit to fast to catch everything.

  9. If I reach 10,000 views on this video I'll make a new one.
    Thinking about making one to show how to add content editing to your website? (Without using wordpress or any third party script)

  10. Dream weaver is ridiculous. Saves all the repetition. I usually like to pass my variables through a IF and pipe it to let them know what's missing

    IF (!$name || !$tel || !$enquiry):
    IF(!$name):
    echo 'Name Is Missing';
    endif;
    IF(!$tel):
    echo 'Telephone is Missing';
    endif;
    IF(!$enquiry):
    echo 'Requirements is Missing';
    endif;
    Else:
    //Run your send.php

    You tutorial is super simple. Thanks again!!

  11. instead of this one
    echo ('<span style="color;text-align:center;")Success!</sapn>)'
    ———————————————–
    try echo with out brackets

    You can try this below,
    you will get the result…………..
    ———————————————-

    <?php
    $s=$_GET["s"];
    if ($s=="1")
    {
    echo '<span style="color:green;text-align:center;">Success! We Have Recieved Your Message.</span>';
    }
    else if ($s=="2")
    {
    echo '<span style="color:red;text-align:center;">Failed! Sorry we did not recieved the message. Please chek the details entered correctly!</span>';
    }
    ?>

    Good Luck guys….
    G Power Tech.

  12. How do I remove this from visibility on my live site?

    Success! Your information has been received. Please allow 24 hours for a response.'); } else if ($s=="2") { echo ('Sorry! You have failed to meet the requirement of submission. Please try again.'); } ?>

Comments are closed.

Copyright © All rights reserved. | Newsphere by AF themes.