Category Archives:

How to Create PHP Contact Form with Email

Sunday, April 10th, 2011
Posted in Education by Joel Gross

Watch my simple tutorial video below on how to create a php contact form that will send an email from your website each time someone submit a contact form:

You can also see the code that I wrote below and use it for your own php contact form with email project:
function createContact()
{
print ‘
Name:
Email:  
Phone:

’;
}
if($_POST['name'] == ”)
{
createContact();
}
else
{
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$message = ‘Name: ‘.$name.’ Email: ‘.$email.’ Phone: ‘.$phone;
mail(‘email@example.com’, ‘Contact Form email from ‘.$name, $message);
print ‘Thank You so much for your contact form’;
}
?>

You can also see the code that I wrote below and use it for your own php contact form with email project: function createContact(){ print ‘

Name:
Email:  
Phone:

’;}

if($_POST['name'] == ”){ createContact();}else{ $name = $_POST['name']; $email = $_POST['email']; $phone = $_POST['phone']; $message = ‘Name: ‘.$name.’ Email: ‘.$email.’ Phone: ‘.$phone; mail(‘email@example.com’, ‘Contact Form email from ‘.$name, $message); print ‘Thank You so much for your contact form’;}?>