Home » Web Tutorials » Make PHP Contact Form for Website

Make PHP Contact Form for Website

Learn to make PHP contact form for your websites

It is very simple to build php contact form for your website. You have to only follow some codes and files. There will be two point you have to remember before making php form.
1. Form Variables
2. Form targetting (Action)
Make php contact form

Learn to make PHP contact form

First make a response page like thanks.html if you are using static website or thanks.php if you are using dynamic website.
Make a php file using text document and name it contactform.php (Make sure it should be in php format not in text) and replace with your email ID and response website link.
$email = $_POST[’email’];
$message = $_POST[‘message’];
$formcontent=”From: $name n Message: $message”;
$recipient = “email@gmail.com“;
$subject = “Contact Form”;
$mailheader = “From: $email rn”;
mail($recipient, $subject, $formcontent, $mailheader) or die(“Error!”);
 header( ‘Location: http://www.yoursite.com/thanks.html‘ ) ;
Click on below link to copy form code and paste this code where you want to show/visible on your website:

Final stage to complete your PHP contact form.

Upload contactform.php file fornt of index.html of index.php .