I have a mysql table column has a date field type which the format is 0000-00-00. Another column is for time format in mysql 00:00:00
So I got dropdown box to let user choose from 00 ~ 23. It is a 24hr format.
I have a drop down box created with some coding using php.
How can i use store this variable $date into the date column?
So how do I change it such that the value can be accepted as a date format?
Code:
echo "<tr>";
echo "<td>Date:</td>";
echo "<td>";
echo "<select name = 'date'>";
$i=0;
$current_date = date("Y-m-d",time());
while ($i<7){
$add_date = date("d-m-Y",strtotime("$current_date + $i days"));
echo "<option>$add_date</option>";
$i++;
}
echo "</select>";
echo "</td>";
echo "</tr>";
.
.
.
$sdate = $_POST['date'];
echo "<tr>";
echo "<td>End Time:</td>";
echo "<td>";
echo "<select name='betimes'>";
foreach ($btimes as $etime){
echo "<option>$etime</option>";
}
echo "</select>";
echo " : 00";
echo "</td>";
echo "</tr>";
$etime = $_POST['betimes'];