You can try

$endDate='2014-04-11';
$startdate='2014-04-01';
$daydiff = floor( ( strtotime( $endDate ) - strtotime( $startdate ) ) / 86400);

echo $daydiff;

it will count the day difference between the 2 dates

Hi as JorgeM said you need a js for it to be done...my suggestion is

  1. Full the data from your db and arrange it as you desire
  2. On page load use windows.print() or add a button or image that when click will call the print dialog box.

like

on page load

<html>
<head>

</head>
<body onload="window.print()">

<?php

DATA FROM DB

?>

</body>
</html>

or using an image or button

 <html>
<head>

</head>
<body>

<?php

DATA FROM DB

?>
<img src="printer.png" width="28" height="28" onclick="window.print()" />

<input type="button" value="Print this page" onclick="printpage()">

</body>
</html>

hey i think this part of the code is wrong

<form action="index.php" method="post">

you must replace it with

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">