for loop for day,month and year

<p>
<label for=”signup_birth_month”>Birthday:</label>
<select name=”day”>
<option value=””>Select Day</option>
<?php  for ($i = 1; $i <= 31; $i++)
{ ?>
<option value=”<?php echo $i;?>”><?php echo $i;?></option>
<?php } ?>
</select>
<select name=”signup_birth_month” id=”signup_birth_month”>
<option value=””>Select Month</option>
<?php

for ($i = 1; $i <= 12; $i++)
{
$month_name = date(‘F’, mktime(0, 0, 0, $i));
?>
<option value=”<?php echo $month_name;?>”><?php echo $month_name;?></option>
<?php    }

?>
</select>
<select name=”year”>
<option value=””>Select Year</option>
<?php  for ($i = 2014; $i >= 1947; $i–)
{ ?>
<option value=”<?php echo $i;?>”><?php echo $i;?></option>
<?php } ?>
</select>
</p>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s