How to make a contact form in HTML using PHP?


In this tutorial you are going to learn how to make simple contact form in PHP?

Conatct form is basically used  when you need user to send feedback to your email address, you can use contact form.

Steps to create contact form , create 2 files
1. contactus.php
2. send-contact.php

In Contactus.php

<form id="contact"  name="contact" action="send-contact.php" method="post">

<label>Your Name</label>
<input name="name" id="name" placeholder="Enter your Name..." type="text"  value="">
<label>Email Id</label>
<input id="email" name="email" placeholder="Enter your Email id..." type="email" value="">
<label>Contact Number</label>

<input id="contactf" name="contact" placeholder="Enter your Contact Number..." type="text" maxlength="10" value="">

<textarea cols="15" name="message" placeholder="Enter your Message...." rows="10" value="">
<input name="submit" type="submit" value="Send Message">


In Send-contact.php


echo $name=$_POST['name'];
echo "<br>";
echo $contact=$_POST['contact'];
echo "<br>";
echo $from = $_POST['email']; echo "<br>";
echo $subject = "Contact info"; echo "<br>";
echo $message = "Name-".$name."\n"."Phone-".$contact."\n"."Message-".$_POST['message']; echo "<br>";
// message lines should not exceed 70 characters (PHP rule), so wrap it
$to = "";
// send mail
$s="Subject: ".$subject;
mail($to,$s,$message,"From: $from\n");


Categories: Html, Php, Technologies


  1. Pretty great post. I just stumbled upon your blog and wished to say that I’ve really enjoyed surfing around your weblog posts. In any case I will be subscribing to your feed and I am hoping you write again soon!

  2. I just want to mention I am just all new to blogs and seriously loved this blog. Very likely I’m going to bookmark your site . You absolutely have fabulous articles. Thanks for revealing your web site.

  3. This is really interesting, You’re a very skilled blogger.
    I have joined your feed and look forward to seeking more of
    your magnificent post. Also, I’ve shared your web site in my
    social networks!

  4. dietplansforwomentoloseweightfast

    We stumbled over here different website and thought I
    should check things out. I like what I see so i am just following you.

    Look forward to going over your web page repeatedly.

  5. Right here is the right web site for everyone who hopes
    to understand this topic. You know a whole lot its almost hard to argue with you. You certainly put a fresh spin on a topic that has been written about for a long
    time. Wonderful stuff, just excellent!

  6. I have been surfing online greater than 3 hours nowadays, but I never discovered any interesting article like yours.

    It is beautiful worth enough for me. In my view, if all site owners and bloggers
    made good content as you probably did, the internet can be
    a lot more helpful than ever before.


Leave A Comment