- This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
Viewing 5 posts - 1 through 5 (of 5 total)
- The forum ‘Back End’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
$date = date('M d Y');
Why am I getting two days?
—-> Aug 2121 2012
These are the results I am getting on the right side below…
d 2121
DD TueTue
D Tue
dd 2121
I just want one day like Aug 21 2012 or Aug 21st 2012
You’ll need to post more code… looks like you’re echoing out in a loop of some kind.
I am sending two emails on one file.
$EmailFrom = "TEST";
$EmailTo = "[email protected]";
$Subject = "Contact Us";
$Name = Trim(stripslashes($_POST));
$Phone = Trim(stripslashes($_POST));
$Email = Trim(stripslashes($_POST));
$Message = Trim(stripslashes($_POST));
// validation
$validationOK=true;
if (!$validationOK) {
print "";
exit;
}
// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "n";
$Body .= "Phone: ";
$Body .= $Phone;
$Body .= "n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "n";
$Body .= "Message: ";
$Body .= $Message;
$Body .= "n";
// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
?>
// CHANGE THE VARIABLES BELOW
$EmailFrom = "TESTTHANK";
$Subject = "Thank You";
$Name = Trim(stripslashes($_POST));
$Email = Trim(stripslashes($_POST));
$date = date('M dd Y');
// prepare email body text
$Body = "";
$Body .= $date."n";
$Body .= "n";
$Body .= "n";
$Body .= $Name . ":";
$Body .= "n";
$Body .= '
I am delighted you contacted us.
';
// send email
$success = mail($Email, $Subject, $Body, "From: <$EmailFrom>");
// redirect to success page
if ($success){
print "";
}
else{
print "";
}
?>
??
Its right there in the code you posted – two ‘d’ (each two digit date).
$date = date('M dd Y');
If I put one d it still outputs two days. Here are the results below…
d 2121
DD TueTue
D Tue
dd 2121