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
https://forums.phpfreaks.com/topic/257611-array-element-in-each-cell/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.