PHP date default select and edit

Date  months and date Edit

Date


 <select name="d" id="d">
    <?php
               for ($i=$i; $i<=31; $i++)
                   {
      ?>
   <option value="<?php echo $i; ?>" <?php echo ($i == date("j") ? 'selected="selected"' : ''); ?>> <?php echo $i; ?></option>
     <?php
                 }
      ?>
 </select>

Months


    <?php
$m=array("","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sept","Oct","Nov","Dec");    
   ?>
<select  name="m" id="m" >
    <?php
                                                         
               for ($i=1;$i<=12; $i++)
                    {
        ?>
                                                              <option value="<?php echo $i; ?>" <?php echo ($i == date("n") ? 'selected="selected"' : ''); ?>><?php echo $m[$i]; ?></option>
    <?php
             }
        ?>
     </select>
Share on Google Plus

About quora Questions & Answers A-Z

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment