Jump to content

array element in each cell


mdvignesh

Recommended Posts

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>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.