mdvignesh Posted February 23, 2012 Share Posted February 23, 2012 Keep the dates in DATE row after i click 'go' It must aligned correct for every month <?php session_start(); if (!$_SESSION['uname']) { header("Location:login.php"); } ?> <html><head><title>Attendance sheet</title> <script src="datetimepicker.js"> </script> </head> <body> <form method="post" action="" > <label for="range_start">Start range:</label> <input name="from" id="frm_date" type="text" > <a href="javascript:NewCal('frm_date','ddmmyyyy')"><img src="cal.gif" alt="pick a date"></a> <label for="range_end">End range:</label> <input name="to" id="dpk" type="text" > <a href="javascript:NewCal('dpk','ddmmyyyy')"><img src="cal.gif" alt="pick a date"></a> <input name="submit" type="submit" value="Go"> <a style="float:right" href="logout.php">Logout</a> <br/><br/> <?php if (isset($_REQUEST['submit'])) { $fromDate = $_REQUEST['from']; $toDate = $_REQUEST['to']; $dateMonthYearArr = array(); $fromDateTS = strtotime($fromDate); $toDateTS = strtotime($toDate); for ($currentDateTS = $fromDateTS; $currentDateTS <= $toDateTS; $currentDateTS += (60 * 60 * 24)) { // use date() and $currentDateTS to format the dates in between $currentDateStr = date("d-M-Y",$currentDateTS); $dateMonthYearArr[] = $currentDateStr; //print $currentDateStr.”<br />”; } echo "<pre>"; print_r($dateMonthYearArr); echo "</pre>"; /* for($dateMonthYearArr = $fromDateTS; $dateMonthYearArr<=$toDate; $dateMonthYearArr++) { print_r($dateMonthYearArr); } */?> <table width="100%" border="1" cellspacing="0" cellpadding="0"> <tr> <th scope="row">DATE</th> <td> <?php print_r($dateMonthYearArr[]); ?></td> <td> <?php //echo $dateMonthYearArr[1]; ?></td> <td> <?php //echo $dateMonthYearArr[2]; ?></td> </tr> <tr> <th scope="row">IN</th> <td> </td> <td> </td> <td> </td> </tr> <tr> <th scope="row">OUT</th> <td> </td> <td> </td> <td> </td> </tr> <tr> <th scope="row">Leave</th> <td> </td> <td> </td> <td> </td> </tr> </table> <?php } ?> </form> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/257611-array-element-in-each-cell/ Share on other sites More sharing options...
trq Posted February 23, 2012 Share Posted February 23, 2012 You forgot to aska question. Quote Link to comment https://forums.phpfreaks.com/topic/257611-array-element-in-each-cell/#findComment-1320361 Share on other sites More sharing options...
mdvignesh Posted February 23, 2012 Author Share Posted February 23, 2012 how to keep each date in the DATE row Quote Link to comment https://forums.phpfreaks.com/topic/257611-array-element-in-each-cell/#findComment-1320363 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.