I have build a select date dropdown list, containing dates for a period of time, starting from the current day. I would like to be able to submit the selected date in a database, however I am having problems with creating the option value.
<?php
$begin = new DateTime('today');
$end = new DateTime('today+120day');
$interval = DateInterval::createFromDateString('1 day');
$period = new DatePeriod($begin, $interval, $end);
<select>
foreach ($period as $dt)
echo "<option value='[]'>".$dt-> format(" d.m.Y")."</option>";
</select>
?>