Make PHP Contact Form for Website

Share Now:

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 = "";
$subject = "Contact Form";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
 header( 'Location:' ) ;
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 .


Post a Comment

You can write your queries or suggestion below in comment box. Please support "Online Discussion Forum".