the operation is to simply either add one day or subtract one day from the current date -
<html>
<head>
<title></title>
</head>
<body>
<form method="post" name="f1">
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
// Default dates
$today = date('Y-m-d H:i:s',strtotime('today'));
// Check the form was submitted
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$today = $_POST['today'];
if($_POST['Submit'] == 'Tomorrow'){
$today = date('Y-m-d H:i:s', strtotime($today . '+1 days'));
}
if($_POST['Submit'] == 'Yesterday'){
$today = date('Y-m-d H:i:s', strtotime($today . '-1 days'));
}
}
?>
<table border="1" align="center" width="100%">
<input type="hidden" name="today" value=<?php echo $today;?>>
<tr>
<td align="center" width="20%"><input type="Submit" name="Submit" value="Yesterday"></td>
<td align="center" width="60%"> <?php echo $today;?></td>
<td align="center" width="20%"><input type="Submit" name="Submit" value="Tomorrow"></td>
</tr>
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
//<!--- Form view --->
echo"<tr><td>query</td></tr>";
}
else{
//<!--- Default view --->
"<tr><td>default</td></tr>";
}
?>
</table>
</form>
</body>
</html>