Hi all,
I have a list box which dynamically generates dates between a min and a max date range.
When the user submits the form, I want their selected value to remain in place while the form is generated.
I am new to PHP and cannot get my head around this. Below is what I have so far.
<select name="theDate" id="theDate">
<option value="">DD</option>
<?php
for ($day = 1; $day <= 31; $day++) {
echo '<option value="' . $day . '">' . $day . '</option>';
}
?>
</select>
I was thinking something along the lines of:
echo '<option value="' . $day . ' 'if($day == $submittedDay){echo . 'selected' ">' . $day . '</option>';
but I cannot get it work.
Any help will be greatly appreciated.
Thanks,
Paul