Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Adding date to contact form

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #39402

    Im trying to add the date to the top of an email confirmation.

    // prepare email body text
    $Body = "";
    $Body .= $Name;
    $Body .= "n";
    $Body .= 'I am delighted you contacted me via our website bla bla bla. ';

    Here is my best try…

    // prepare email body text
    $Body = "";
    $Body .= ;
    $Body .= $Name;
    $Body .= "n";
    $Body .= 'I am delighted you contacted me via our website. ';

    Thanks,
    Obvious PHP Rookie

    #108137
    irish1381
    Member

    You’re concatenating your message via your $Body variable, so it is rending in the message…. So, printing out the date isn’t going to work. You’ll need to create a date variable and append it in your message.

    ie:


    $date = date('Ymd'); // or whatever format you'd like

    $Body = "blah...blahn";
    $Body .= "The date is: ".$date."n";
    //etc, etc...
    #108206

    Seems that broke it without error message. See anyhting strange?


    $EmailFrom = "TESTTHANK";
    $Subject = "Thank You";
    $Name = Trim(stripslashes($_POST));
    $Email = Trim(stripslashes($_POST));
    $date = date('Ymd');

    $Body = "";
    $Body .= "The date is: ".$date."n";
    $Body .= $Name . ",";
    $Body .= "n";
    $Body .= '
    I am delighted you contacted me via our website.
    Sincerely,
    Kelly Mills
    ';
    #108278
    irish1381
    Member

    What’s happening that’s indicating that something is broke? Are you not receiving the email? If so, can you post more code. Also, for the sake of consistency I would use lowercase trim() since that’s how it appears in the manual…

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘Back End’ is closed to new topics and replies.