<?php
	session_start();
	if($_SESSION['rid'])
	{
		$userid=$_SESSION['rid'];
	}
	else
	{
		header('location:../login.php');
	}
?>
<?php
//$connect = mysqli_connect("localhost", "root", "", "testing");
include'connection.php';
include'time.php';

//$sql = "SELECT * FROM recharge where Userid='500227' and Rechargedate='2019-09-26'";  
$result = mysqli_query($con, $sql);
?>
<html>  
 <head>  
  <title>Export MySQL data to Excel in PHP</title>  
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />  
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>  
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>  
 </head>  
 <body>  
  <div class="container">  
   <br />  
   <br />  
   <br />  
   <div class="table-responsive">  
    <h2 align="center">Export MySQL data to Excel in PHP</h2><br /> 
    <table class="table table-bordered">
                    <tr>  
                        <th>Recharge Id</th>  
                        <th>Date</th>  
                        <th>Time</th>  
                        <th>Mobile No.</th>  
                        <th>Operator</th>  
                        <th>Amount</th>  
                        <th>Credit Used</th>  
                        <th>Status</th>
                        <th>Operator Id</th>
                    </tr>
     <?php
     while($row = mysqli_fetch_array($result))  
     {  
        echo '  
       <tr> 
                    <td>'.$row["Id"].'</td>  
                    <td>'.$row["Rechargedate"].'</td>  
                    <td>'.$row["Time"].'</td>  
                    <td>'.$row["Mobile"].'</td>  
                    <td>'.$row["Companyname"].'</td>  
                    <td>'.$row["Amount"].'</td>
                    <td>'.$row["Debitamount"].'</td>
                    <td>'.$row["Status"].'</td>
                    <td>'.$row["Operatorid"].'</td>
       </tr>  
        ';  
     }
     ?>
    </table>
    <br />
    <form method="post" action="export.php">
        <input type="date" name="date">
     <input type="submit" name="export" class="btn btn-success" value="Export" />
    </form>
   </div>  
  </div>  
 </body>  
</html>
