Is it possible for me to set the value of input = 'month'
using php? I have seen that it is possible using javascript.. but I want to achieve it using php....
I'm trying to set a default value for the input = month
..
however the value that I set doesn't take effect..
here's what I did.
when I tried to display it outside the element <?=date('F-Y')?>
it displays the date and month just fine..
<input type="month" value="<?=date('F-Y')?>" class="form-control per_date_inputs" name="month"/>
The <input type="month"> defines a month and year control. The format is "YYYY-MM".
<input type="month" value="<?=date('Y-m')?>" class="form-control per_date_inputs" name="month"/>
Instead of
<input type="month" value="<?=date('F-Y')?>" class="form-control per_date_inputs" name="month"/>
Use this
<input type="month" value="<?=date('Y-m')?>" class="form-control per_date_inputs" name="month"/>
<input type="month" value="2016-03" class="form-control per_date_inputs" name="month"/>
input type=month takes "yyyy-mm" format only
If you wanna to make a code for default value for Date or Month; here is the solution:
This is for Date:
<input type="date" name="" id="" value="1982-10-25">
Write the year first then, the month then, the day.
This is for Month:
<input type="month" name="" id="" value="1982-10">
Write the year first then, the month.
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