Saturday, May 27, 2023

Get Month's Name using PHP Logic

 

Month's Name using PHP Logic

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

Front-End Custom Development

  Front-End Custom Development Our front-end functional components are tailor-made, crafted from the ground up to provide not only exception...

Clock