I am using SQL to query some dates (datetime Y-m-d H:i:s) from a database and putting them into a select box. The problem is when I am using $_POST to send the selected value to the next page, only the date appears, the time has gone missing. Please can you help, thanks.
eg. 2015-02-11 12:34 changes to just 2015-02-11
From the first page:
session_start()
####some codes here####
echo '<form action ="selected.php" method ="POST">';
echo "<select name='production_time' class='input'></option>";
foreach($res as $row) {
$mysqldate = date('Y-m-d H:i:s', strtotime($row['date_time']) );
echo "<option value=$mysqldate>$mysqldate</option>";
}
echo "</select>";
echo "<p> </p> <br/ > ";
echo '<p><input type="submit" class ="button"></p>';
echo '</form>';
From the second page:
session_start();
echo '<div id="middle">';
$selected_date = $_POST['production_time'];
echo $selected_date ;
echo '<br />';
echo '</div>';