Jump to content

Email form


tapupartforpres

Recommended Posts

Hello got a basic email form.  In one field I am pulling a read only javascript to show the current date (plus a bunch of other fields).

 

<input id="tDate" readonly="readonly" name="tDate" type="text"></td>

 

All the fields are coming across in email and is processing correctly except this field.

 

  <?php 


$SendFrom =    "DUKE";
$SendTo =      "[email protected]";
$SubjectLine = "Database Change Request";
$Divider =     "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~";
$tDate = $_REQUEST['tDate'] ; 
$New_Message = "Date Verified:_______________________";



$MsgBody = "\n$tDate\n";
$MsgBody = "\n$New_Message\n";
foreach ($_POST as $Field=>$Value)
   $MsgBody .= "$Field: $Value\n";
$MsgBody .= "$Divider\n" . $_SERVER["HTTP_USER_AGENT"] . "\n";
$MsgBody = htmlspecialchars($MsgBody); 

mail($SendTo, $SubjectLine, $MsgBody, "From: $SendFrom");

$msg_cbc = "Thank you filling out all the information correctly. You will be contacted to verify this information shortly.";

?>

 

Any ideas on how I can get the date to come over in the email?  Thanks

 

 

Link to comment
https://forums.phpfreaks.com/topic/176748-email-form/
Share on other sites

try this:

 

 <?php 
      
   $date = date('d-m-y');
   
$SendFrom =    "DUKE";
$SendTo =      "[email protected]";
$SubjectLine = "Database Change Request";
$Divider =     "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~";
$tDate = $_REQUEST['tDate'] ; 
$New_Message = "Date Verified:_______________________";



$MsgBody = "\n$date\n";
$MsgBody = "\n$New_Message\n";
foreach ($_POST as $Field=>$Value)
   $MsgBody .= "$Field: $Value\n";
$MsgBody .= "$Divider\n" . $_SERVER["HTTP_USER_AGENT"] . "\n";
$MsgBody = htmlspecialchars($MsgBody); 

mail($SendTo, $SubjectLine, $MsgBody, "From: $SendFrom");

$msg_cbc = "Thank you filling out all the information correctly. You will be contacted to verify this information shortly.";

?>

Link to comment
https://forums.phpfreaks.com/topic/176748-email-form/#findComment-931898
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.