<?php
//Let's just pretend the HTML is already done up there ^^ we have to fields: name and email.
//And a submit button.
//So, first let's make sure we pressed the submit button, we will do this by using isset.
if(isset($_POST['submit']))
//Submit button was pressed.
{
//So we will assign vars.
$name = $_POST['name'];
$email = $_POST['email'];
//Now we will add from etc.
//From
$from = 'noreply@example.com';
//Subject
$subject = 'You've got spam!';
//To
$to = 'example@example.com';
}
else
{
//we did not press the submit.
}