I am having trouble showing the date in an email which is being submitted with php. I am a complete beginner with PHP so I suspect this is very basic but help would be greatly appreciated, my sendmail code is below . I would like to show the date and time the email was submitted in the body of the email.
All help is greatly appreciated!!Code:<?php $to = $_REQUEST['sendto'] ; $from = $_REQUEST['phone'] ; $Name = $_REQUEST['name'] ; $headers = "From: \"----.co.uk\"<noreply@----.co.uk>\r\n". "Return-Path: <noreply@----.co.uk>\r\n". "X-Mailer: PHP/" . phpversion(); $subject = "---- website contact request"; $fields = array(); $fields{"name"} = "name"; $fields{"company"} = "company"; $fields{"phone"} = "phone"; $fields{"creative"} = "creative"; $fields{"publicrelations"} = "publicrelations"; $fields{"digital"} = "digital"; $body = "Below is the result of your feedback form:\n\n";echo date("Y/m/d"); foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); } $headers2 = "From: noreply@----.co.uk"; $subject2 = "---- website contact request"; if($from == '') {print "You have not entered a phone number, please go back and try again";} else { if($Name == '') {print "You have not entered a name, please go back and try again";} else { $send = mail($to, $subject, $body, $headers); if($send) {header( "Location: http://www.----.co.uk/thankyou.php" );} else {print "We encountered an error sending your mail, please notify ----@----.co.uk"; } } } ?>



Reply With Quote
Bookmarks