Simple drop down list using thrugh loops & array

5 views
Skip to first unread message

Sanam Shrestha

unread,
Jan 27, 2013, 12:12:34 AM1/27/13
to phpgroup2...@googlegroups.com
register_form.php

innocentumesh

unread,
Jan 27, 2013, 7:05:25 AM1/27/13
to phpgroup2...@googlegroups.com
Awesome...............

On Sunday, January 27, 2013 10:57:34 AM UTC+5:45, Sanam Shrestha wrote:

innocentumesh

unread,
Jan 27, 2013, 7:28:41 AM1/27/13
to phpgroup2...@googlegroups.com
I have made certain changes.......... As i like to display in my page....... and value is required.
<select name="day">
           <option selected='selected'>Day:</option>
          <?php for($i=1; $i <=31; $i++){echo '<option value="'.$i.'">'. $i. '</option>';} ?>
          </select>
          <select name="month">
           <option selected='selected'>Month:</option>
           <?php
           $months = array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
           foreach($months as $month){echo ' <option value="'.$m=($m+1).'">'.$month. '</option>';}
           ?>
          </select>
          <select name="year">
           <option selected='selected'>Year:</option>
           <?php for($d =2010; $d >= 1910; $d--){echo ' <option value="'.$d.'">'. $d. '</option>';}  ?>
          </select>
Reply all
Reply to author
Forward
0 new messages