tags:

views:

22

answers:

1

I wrote this PHP script to retrieve my form results via email. Everything works great, but I don't know how to add a time and date stamp of the results. Here is my current code:

<?php
$name = $_REQUEST['name'] ;
$carenumber= $_REQUEST['carenumber'] ;
$email = $_REQUEST['email'] ;
$topic = $_REQUEST['topic'] ;
$message = $_REQUEST['message'] ;

$Body = "";
$Body .= "Name: ";
$Body .= $name;
$Body .= "\n";
$Body .= "\n";
$Body .= "Caregiver Number: ";
$Body .= $carenumber;
$Body .= "\n";
$Body .= "\n";
$Body .= "Email Address: ";
$Body .= $email;
$Body .= "\n";
$Body .= "\n";
$Body .= "Topic: ";
$Body .= $topic;
$Body .= "\n";
$Body .= "\n";
$Body .= "Message: ";
$Body .= $message;
$Body .= "\n";

mail( "[email protected]", "Message From Myorphan.com Contact Page",
$Body, "From: $email" );

header( "Location: http://www.feedmyorphan.com/contact_confirm.htm" );
?>
+1  A: 

You should just add:

$Body .= "Sent Date: ";
$Body .= date("F j, Y, g:i a");       // October 22, 2010, 5:16 pm
Adnan
How would you add AM or PM?
Erik
Check doc: http://php.net/manual/en/function.date.php
bazmegakapa
@Erik just updated my answer
Adnan