daz daz - 3 months ago 10
MySQL Question

how to Get date from input form within Mysql in PHP

how to Get date from input form within Mysql in PHP



<tr>

<td>
<div class="field-row">
<label class="form-label" for="dateOfBirth">Date of birth</label>
<input type="date" id="dob" class="field date-field dob-field" min="1900-01-01" max="2016-12-31" required>
<span class="message"></span>
</div>
</td>
</tr>




Answer

Add 'name' attribute then use it in php $_POST.

<input type="date" id="dob" name="exdate" class="field date-field dob-field" min="1900-01-01" max="2016-12-31"  required>

In php, you can get this by

$exdate=$_POST['exdate'];

Then use it in mysq query

WHERE columnname='$exdate'