I am building a application for web using php and mysql database. I am using a template for the frontend, bootstrap template, however, when I choose the date and submit the form, the date doesn't go into the mysql, I have set the data type for my date as DATE in mysql. i can't seem to figure out why. Here is the code for the date.
<div class="form-group">
<label class="col-sm-3 control-label">Request Date</label>
<div class="col-sm-6">
<input class="input-sm input-s datepicker-input form-control" size="16" type="text" data-date-format="dd-mm-yyyy" name="requestDate" id="requestDate" data-required="true">
</div>
</div>
Here is the Execution code for the form:
<?php
include("dbconnection.php");
print_r($_POST);
$id = $_POST['id'];
$seoSro = $_POST['seoSro'];
$projectStatus = $_POST['projectStatus'];
$requestDate = $_POST['requestDate ];
------ the correct one ---------
$requestDate = date("Y-m-d",strtotime($_POST['requestDate']));
Please help me guys, it enters 0000-00-00 data into the database.