Generate function for date by loop in form

<?php
  function generateOptions($start,$end,$inc){
    $options = '';
    for($i=$start; $i<=$end; $i+=$inc){
      $options = $options.'<option>'.$i.'</option>';
    }
      return $options;
  }
?>


       <select>
          <option>Day</option>
            <?php echo generateOptions(1,31,1); ?>
        </select>

Comments

Popular posts from this blog

Git post receive setup at server for git push to the production from local machine

Deploy laravel application to digital ocean droplet