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

WP register_post_type() with custom CMB2 meta box

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