Here's the form handler...
<?
if( isset( $_POST['submit'] ) )
{
# The email recipient
$to = 'user@host.tld';
# The subject of the email
$subject = 'some subject';
# From whom
$from = 'user@host.tld';
foreach( $_POST as $k => $v )
{
if( $k != 'submit' )
$message .= $k . ' = ' . $v . "\n";
}
if( mail( $to, $subject, $message, 'From: ' . $from ) )
echo 'Thanks.';
else
echo 'Something went wrong!';
}
?>
Put the form handler into e.g. formhandler.php and when you make the form, be sure the action of the form is the name of the form handler document.
Like...
<form [b]action="formhandler.php"[/b] method="post">
Name: <input type="text" name="name"><br>
Email: <input type="text" name="email"><br>
<input type="submit" name="submit" value="submit">
</form>
Then make sure the form button has the name "submit".