0

My form has two filters.

1) fromdate 2) todate

If user select FromDate = 01-05-2015 AND Todate = 31-05-2015 then it display all days between fromdate and todate in header.

Expected output

 Days - 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 

My filter code to select fromdate and todate

Fromdate : <input type="text"  name="fromdate" id="datepicker"></th>
todate : <input type="text"  name="todate" id="datepicker1">

Display code to echo all days in column.

<tr>
                    <th width="25%">Days</th>
            <?php for ($i = $fromdate; $i <= $todate; $i++)
            { ?>            
            <th width="26%"><?php echo date($i); ?></th>
                            <?php   }?> 
        </tr>
ankit ingle
  • 213
  • 1
  • 5
  • 10

1 Answers1

0

try this

<?php
$startdate = '2015/05/01'; 
$enddate = '2007/05/31'; 
$start = date('d', strtotime($startdate));
$end=date('d', strtotime($enddate));

for ($x = $start; $x <= $end; $x++) {
    echo "$x <br>";
} 

?>
user1844933
  • 3,296
  • 2
  • 25
  • 42