How can I save a datetime-local input value into a text file on php? I have studied 1, 2 with no success.
I am already doing it with text and email:
<?php {$text = $_REQUEST['text'];$email = $_REQUEST['email'];$datetime = $_REQUEST['datetime_local_input'];$body = "$email $text $datetime";$file = fopen("f.txt", "a");fwrite($file, "\n" . $body."\n");fclose($file);} ?>
I use a simple input:
<input class="dt" type="datetime-local" name="datetime_local_input" title="choose date and time" required />
I solved it eventually by creating a new form with action=""
, method="post"
and using the above php and html. That saves successfully the value in the .txt file. Thanks everyone! I guess less is more.