Get Month's Name using PHP Logic
<select class="form-control border border-success">
<option value="">--select month...</option>
<?php
$curmonth = date("F");
for($i = 1 ; $i <= 12; $i++)
{
$allmonth = date("F",mktime(0,0,0,$i,1,date("Y")))
?>
<option value="<?php
echo $i; ?>" <?php
if($curmonth==$allmonth) echo ' selected';
?>>
<?php
echo date("F",mktime(0,0,0,$i,1,date("Y")));
//Close tag inside loop
?>
</option>
<?php } ?>
</select>
No comments:
Post a Comment