Continuing from my earlier question, how can I combine the month, day, and year <select>
s into a single "date" value, so that it arrives at my PHP script as
$_POST['date']
, in MySQL format YYYY-MM-DD
?
You could use a hidden field and build its value onSubmit, but if I were you, I'd simply use the array notation in the name attribute, and implode the array with '-' as glue : like this
<select name="date[year]">
...
<select name="date[month]">
...
<select name="date[day]">
...
php:
$date = implode('-', $_POST['date'])
//validate date format here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With