I can't seem to get this email to send, note that I am trying to send email to the address the user just submitted...it posts to the DB... suggestions?
<?php
$lastname = $_POST['lastName'];
$email = $_POST['email'];
$id = $_POST['id'];
$site = $_POST['site'];
$dbh = new PDO('mysql:host=dbaddress;dbname='dbname, 'user', 'pass') or die(PDO::errorInfo());
$sth = $dbh->prepare("
INSERT INTO table (lastName, email, id, site)
VALUES (?, ?, ?, ?)
");
$sth->execute(array($lastname, $email, $id, $site)) or die(array_pop($sth->errorInfo()));
$dbh = null;
$to = '$email';
$subject = 'the subject';
$message = 'my message goes here';
$headers = 'From: myemailaddress@mail.com' . "\r\n" .
'Reply-To: webmaster@mail.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
header("Location:thankyou.html");
?>