File: /var/www/nclive/technc/pagewise_report.php
<?php include 'header.php'; ?>
<style>
table,th,td{
text-align: center;
background-color: white;
}
.col_1 {
padding: 16px 10px 12px;
font-family: "Source Sans Pro", "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 15px;
font-weight: 600;
text-transform: uppercase;
border-bottom: 1px solid #ddd;
border-top: 0;
background-color: #f9eae8;
}
.col_2{
padding: 6px 8px;
border-top: 1px solid #f0f0f0;
line-height: 1.42857143;
vertical-align: top;
text-align: center;
text-transform: capitalize;
border-collapse: collapse;
font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
}
.heading_contains{
margin-bottom: 15px;
font-weight: 600;
font-size: 15px;
color: #8c8c8c;
text-transform: uppercase;
}
.form_search{float:right;
margin-top: -19px;
margin-right: 45px;
font-weight: 600;
font-size: 16px;
color: #8c8c8c;
}
</style>
<?php
$subquery="WHERE country='IN'";
if(isset($_REQUEST['search_type'])){
$date=$_REQUEST['date'];
if($_REQUEST['search_type']=='1' && $_REQUEST['date']!=''){
$subquery = "where visit_date LIKE '%$date%' AND country='IN'";
}
else if($_REQUEST['search_type']=='2' && $_REQUEST['fromdate']!='' && $_REQUEST['todate']!=''){
$fromdate=$_REQUEST['fromdate'];
$todate=$_REQUEST['todate'];
$subquery = "WHERE visit_date BETWEEN '$fromdate' AND '$todate' AND country='IN'";
}
}
$query = "SELECT visit_page,region, count(visit_page) as total,visit_date FROM sp_track_visitors $subquery group by (visit_page) order by(total ) DESC";
$sql=$db->prepare($query);
$sql->execute();
?>
<main id="main-container">
<h2 style="margin-left: 17em; font-weight: 600; font-size: 16px; color: #8c8c8c; text-transform: uppercase;">Page Wise Report </h2>
<form style="margin-left: 4em; margin-top: 10px;" method="post" action="">
<table >
<tr>
<!-- ******* Search By Single Date ***** -->
<td >On the Date:<input type="radio" name="search_type" value="1"/>
<td>
<input type="date" name="date" id="date"/>
</td>
</td>
<!-- ****** Search By Between Dates ****** -->
<td >Between Dates <input type="radio" name="search_type" value="2"/> </td>
<td width="20%" style="vertical-align: top;">
<input type="date" name="fromdate" id="fromdate" placeholder="From Date"/><br>
<input type="date" name="todate" id="todate" placeholder="To Date"/>
</td>
<td>
<input type="submit" value="Search" name="submit"/>
</td>
</tr>
</table>
</form>
<div class="content content-narrow">
<div class="row">
<div class="col-md-12">
<table class="t1" width="100%">
<tr style="border-bottom: 1px solid #ddd; background-color: #f9eae8; border-top:0px;">
<th class="col_1" >S.no</th>
<th class="col_1" >Page Name</th>
<th class="col_1" >count</th>
</tr>
<?php
$i=1;
while($row=$sql->fetch()){
?>
<tr>
<td class="col_2"><?php echo $i;?></td>
<td class="col_2"><?php echo $row['visit_page']; ?></td>
<td class="col_2"><?php echo $row['total']; ?></td>
</tr>
<?php $i++; } ?>
</table>
</div>
</div>
</div>
</main>
<?php include 'footer.php'; ?>