hihi hihi - 1 month ago 6
HTML Question

html dropdown list for month

I would like to ask why the dropdown list for month is not according to what the code said?The dropdown list supppose to show from september to october.

The screenshot image of the dropdown list

<select class="selectpicker" id="selectmonth" onchange="myFunction()">
<option value="<?php echo date('m', strtotime('-1 month')) ?>"><?php echo date('F', strtotime('-1 month')) ?></option>
<option value="<?php echo date('m', strtotime('-2 month')) ?>"><?php echo date('F', strtotime('-2 month')) ?></option>
<option value="<?php echo date('m', strtotime('-3 month')) ?>"><?php echo date('F', strtotime('-3 month')) ?></option>
<option value="<?php echo date('m', strtotime('-4 month')) ?>"><?php echo date('F', strtotime('-4 month')) ?></option>
<option value="<?php echo date('m', strtotime('-5 month')) ?>"><?php echo date('F', strtotime('-5 month')) ?></option>
<option value="<?php echo date('m', strtotime('-6 month')) ?>"><?php echo date('F', strtotime('-6 month')) ?></option>
<option value="<?php echo date('m', strtotime('-7 month')) ?>"><?php echo date('F', strtotime('-7 month')) ?></option>
<option value="<?php echo date('m', strtotime('-8 month')) ?>"><?php echo date('F', strtotime('-8 month'))?></option>
<option value="<?php echo date('m', strtotime('-9 month')) ?>"><?php echo date('F', strtotime('-9 month')) ?> </option>
<option value="<?php echo date('m', strtotime('-10 month')) ?>"><?php echo date('F', strtotime('-10 month')) ?> </option>
<option value="<?php echo date('m', strtotime('-11 month')) ?>"><?php echo date('F', strtotime('-11 month')) ?> </option>
<option value="<?php echo date('m', strtotime('-12 month')) ?>"><?php echo date('F', strtotime('-12 month')) ?> </option>
</select>

Answer

its done

      <select class="selectpicker" id="selectmonth" onchange="myFunction()">
                        <option value="<?php echo date("m",strtotime("-1 Months",strtotime(date('01-m-Y')))) ?>"><?php echo date("F",strtotime("-1 Months",strtotime(date('01-m-Y')))) ?></option>
                        <option value="<?php echo date("m",strtotime("-2 Months",strtotime(date('01-m-Y')))) ?>"><?php echo date("F",strtotime("-2 Months",strtotime(date('01-m-Y')))) ?></option>
                        <option value="<?php echo date("m",strtotime("-3 Months",strtotime(date('01-m-Y')))) ?>"><?php echo date("F",strtotime("-3 Months",strtotime(date('01-m-Y')))) ?></option>
                        <option value="<?php echo date("m",strtotime("-4 Months",strtotime(date('01-m-Y')))) ?>"><?php echo date("F",strtotime("-4 Months",strtotime(date('01-m-Y')))) ?></option>
                        <option value="<?php echo date("m",strtotime("-5 Months",strtotime(date('01-m-Y')))) ?>"><?php echo date("F",strtotime("-5 Months",strtotime(date('01-m-Y')))) ?></option>
                        <option value="<?php echo date("m",strtotime("-6 Months",strtotime(date('01-m-Y')))) ?>"><?php echo date("F",strtotime("-6 Months",strtotime(date('01-m-Y')))) ?></option>
                        <option value="<?php echo date("m",strtotime("-7 Months",strtotime(date('01-m-Y')))) ?>"><?php echo date("F",strtotime("-7 Months",strtotime(date('01-m-Y')))) ?></option>
                        <option value="<?php echo date("m",strtotime("-8 Months",strtotime(date('01-m-Y')))) ?>"><?php echo date("F",strtotime("-8 Months",strtotime(date('01-m-Y'))))?></option>
                        <option value="<?php echo date("m",strtotime("-9 Months",strtotime(date('01-m-Y')))) ?>"><?php echo date("F",strtotime("-9 Months",strtotime(date('01-m-Y')))) ?> </option>
                        <option value="<?php echo date("m",strtotime("-10 Months",strtotime(date('01-m-Y')))) ?>"><?php echo date("F",strtotime("-10 Months",strtotime(date('01-m-Y')))) ?> </option>
                        <option value="<?php echo date("m",strtotime("-11 Months",strtotime(date('01-m-Y')))) ?>"><?php echo date("F",strtotime("-11 Months",strtotime(date('01-m-Y')))) ?> </option>
                        <option value="<?php echo date("m",strtotime("-12 Months",strtotime(date('01-m-Y')))) ?>"><?php echo date("F",strtotime("-12 Months",strtotime(date('01-m-Y')))); ?> </option>
                    </select>