NDi
NDi

Reputation: 342

How to save datetime-local value in text file on php?

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 />

Upvotes: 0

Views: 252

Answers (1)

NDi
NDi

Reputation: 342

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.

Upvotes: 0

Related Questions