0

Хочу передать дату и время из

 <input class="form-control" type="datetime-local" name="dateC" value="<?php echo date('Y-m-d\TH:i:s'); ?>" id="example-datetime-local-input">

В переменную $date в таком же формате Y-m-d\TH:i:s как это осуществить?

2
  • она попадёт в $_REQUEST('dateC')
    – Dmitriy
    11 фев 2021 в 9:02
  • А как мне тогда передать его в переменную? Есть такая возможность?
    – Evgeny
    11 фев 2021 в 9:15

1 ответ 1

0
<form action="form.php" method="post">
<input class="form-control" type="datetime-local" name="dateC" value="<?=date('Y-m-d\TH:i:s'); ?>" id="example-datetime-local-input">
<button type="submit">Отправить</button>
</form>

Файл form.php

<?
    $date = $_POST['dateC'];
?>

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.