I've got a basic web form, and I need to take a date from a "date" type input (html5 see http://www.w3schools.com/html/tryit.asp?filename=tryhtml5_input_type_date) and post it into my MySQL database (which has a type of DATE - note: not DATETIME).
I need some kind of PHP/JS voodoo to make the 2 talk to each other, Any clues?
Heres what I've got so far, and it always produces the default date of 1970-01-01.
Would it be better to do it as a plain input and force the format with Jquery?
<!-- zee form: -->
<div>
<!-- Start Date -->
<div>
<label class="col-offset-half col-3" for="order_contractStart">Contract Start:</label>
<input class="col-offset-half col-7" type="date" id="order_contractStart" name="order_contractStart">
</div>
<!-- End Date -->
<div>
<label class="col-offset-half col-3" for="order_contractEnd">Contract End:</label>
<input class="col-offset-half col-7" type="date" id="order_contractEnd" name="order_contractEnd">
</div>
Then in my action I have:
//Get Variables from form
$start = date("Y-m-d", $_GET['order_start']);
$end = date("Y-m-d", $_GET['order_end']);
Turns out this method isn't really working - so any pointers would be greatly appreciated.