New PHP person here..
I am setting up an event registration page. The users must select from two arrival dates for hotel and flights. from my database, I am able to populate a dropdown with the two dates.
"SELECT DATE_FORMAT(firstarrival, '%d %M %Y') as newfirsta, DATE_FORMAT(secondarrival, '%d %M %Y') as newseconda, DATE_FORMAT(firstdepart, '%d %M %Y') as newfirstd, DATE_FORMAT(seconddepart, '%d %M %Y') as newsecondd FROM testevent WHERE id = ".$id.""
I format the date to make it look nice (if i don't, it shows up as 0000-00-00). The problem is, when I try and insert the record, it shows up as zeros anyway.
Below is the snippet from the drop down. If i need to format the date back, should I do it here or what?
Thanks,
<label>Please Select Your Arrival Date:</label>
<select name="arrivaldate" id="arrivaldate">
<?php foreach ($traveldates as $traveldate) { ?>
<option value="<?php echo htmlentities ($traveldate["newfirsta"]) ?>"><?php echo htmlentities ($traveldate["newfirsta"]) ?>
<option value="<?php echo htmlentities ($traveldate["newseconda"]) ?>"><?php echo htmlentities ($traveldate["newseconda"]) ?> <?php } ?>
</select>