I am trying to include the current date, senders IP and Host in my contact form submission.
This is the code:
<?php
if( isset($_POST['name']) )
{
$to = 'info@mydomain.com'; // Replace with your email
$subject = 'Contact Form Submission'; // Replace with your $subject
$headers = 'From: ' . $_POST['email'] . "
" . 'Reply-To: ' . $_POST['email'];
$date = date('M jS, Y @ h:i a');
$IP = $_SERVER['REMOTE_ADDR'];
$Host = $_SERVER['HTTP_HOST'];
$message = 'Name: ' . $_POST['name'] . "
" .
'E-mail: ' . $_POST['email'] . "
" .
'Subject: ' . $_POST['subject'] . "
" .
'Department: ' . $_POST['department'] . "
" .
'Message: ' . $_POST['message'] . "
" .
'Date: ' . $_POST['$date'] . "
" .
'IP: ' . $_POST['$IP'] . "
" .
'Host: ' . $_POST['$Host'];
mail($to, $subject, $message, $headers);
if( $_POST['copy'] == 'on' )
{
mail($_POST['email'], $subject, $message, $headers);
}
}
?>
The Email is received, but without Date, IP and Host. Any help would be greatly appreciated.