Search code examples
phpformsemailfwrite

How to include date in fwrite?


I currently have an fwrite below which occurs when a form is filled out, I want to put the current date the form was filled out within the fwrite, how would I do this?

fwrite($fh, "$firstname\r\n $lastname\r\n $email\r\n $zipcode\r\n $feedback\r\n \r\n");

Solution

  • Try like this:

    $date=date("Y-m-d H:i:s");
    fwrite($fh, "$firstname\r\n $lastname\r\n $email\r\n $zipcode\r\n $feedback\r\n $date\r\n \r\n");