i want to print a selectbox according to the month date.
1. if month is of 28 days there will show 28 selectbox
2. if month is of 31 days there will show 31 selectbox.
1. if month is of 28 days there will show 28 selectbox
2. if month is of 31 days there will show 31 selectbox.
Code:
<?php session_start(); $countDate = date('d'); $currMonth = date('m'); $currYear = date('Y'); $countDay = days_in_month($currMonth,$currYear); function days_in_month($month, $year) { return $month == 2 ? ($year % 4 ? 28 : ($year % 100 ? 29 : ($year % 400 ? 28 : 29))) : (($month - 1) % 7 % 2 ? 30 : 31); } ?> </head> <body> <div> <table> <thead> <th>Name</th> <?php for($i=1; $i<=$countDay; $i++) {?> <th><?php echo $i;?></th> <?php } ?> </thead> <tbody> <?php while($row = mysql_fetch_array($query)) { echo ' <td>'.$row['name'].'</td>';} ?> <td> <?php for ($a=3; $a<25; $a++) {?> <?php echo $a; ?> <?php } ?> <?php $b = "<select> <option>dfkjfdg</option> </select>"; for ($c=$b; $c<5; $c++) { echo $c; } ?> </td> </tbody> </table> </div> </body> </html>
Comment