Hi, I have 2 fields that are used for date. In my fucntion, i have it format the date into Y-m-d format,
$purchase_date = mysqli_real_escape_string($mysqli,date('Y-m-d',$_POST['purchase_date']));
$warranty_end_date = mysqli_real_escape_string($mysqli,date('Y-m-d',$_POST['warranty_end_date']));
But when I enter a date into it, it just puts 0000-00-00
I thought this was the correct format, but seems to not work.
I did try this as well:
$purchase_date = mysqli_real_escape_string($mysqli, date('Y-m-d', strtotime(str_replace('-','/',$_POST['purchase_date']));
$warranty_end_date = mysqli_real_escape_string($mysqli, date('Y-m-d', strtotime(str_replace('-','/',$_POST['warranty_end_date']));
but didnt work either.
Here is the form elements as well:
<div class="form-group">
<label for="purchase_date">Purchase Date</label>
<input type="text" name="purchase_date" class="form-control" id="purchase_date" placeholder="Purchase Date">
</div>
<div class="form-group">
<label for="warranty_end_date">Warranty End Date</label>
<input type="text" name="warranty_end_date" class="form-control" id="warranty_end_date" placeholder="Warranty End Date">
</div>