tapupartforpres Posted October 6, 2009 Share Posted October 6, 2009 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 More sharing options...
nafetski Posted October 6, 2009 Share Posted October 6, 2009 how are you sending the data to the form? Instead of using the $_REQUEST superglobal, I would use either $_GET or $_POST Link to comment https://forums.phpfreaks.com/topic/176748-email-form/#findComment-931871 Share on other sites More sharing options...
merylvingien Posted October 6, 2009 Share Posted October 6, 2009 Why not use php for the date? $today = date('d-m-y'); Link to comment https://forums.phpfreaks.com/topic/176748-email-form/#findComment-931886 Share on other sites More sharing options...
nafetski Posted October 6, 2009 Share Posted October 6, 2009 Yeah that really is the better solution Link to comment https://forums.phpfreaks.com/topic/176748-email-form/#findComment-931889 Share on other sites More sharing options...
Jnerocorp Posted October 6, 2009 Share Posted October 6, 2009 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 More sharing options...
Paystey Posted October 6, 2009 Share Posted October 6, 2009 Try using the variable you put the date in. You set: $tDate = $_REQUEST['tDate'] ; then used: $MsgBody = "\n$date\n"; also try turning on E_WARNING Link to comment https://forums.phpfreaks.com/topic/176748-email-form/#findComment-931970 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.