html - I want to be assisted with a PHP code that displays the data from the database including pdf file (Admission Letter) for downloading
one text
Am coding using PHP and HTML. I want to create a simple system that allows once to create an account then logs in. Once logged in one can search the admission letter using index number. Then it displays the ref number the index number the name and the admission letter where he or she will download or print the admission letter.
I have done this. the only challenge am getting is displaying the pdf file fro printing
code
<body class="materialdesign">
<div class="wrapper-pro">
<?php include_once('includes/sidebar.php');?>
<?php include_once('includes/header.php');?>
<!-- Breadcome start-->
<div class="breadcome-area mg-b-30 small-dn">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<div class="breadcome-list shadow-reset">
<div class="row">
<div class="col-lg-12">
<ul class="breadcome-menu">
<li><a href="dashboard.php">Home</a> <span class="bread-slash">/</span>
</li>
<li><span class="bread-blod">Search Admission Letter</span>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Breadcome End-->
<!-- Static Table Start -->
<div class="data-table-area mg-b-15">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<div class="sparkline13-list shadow-reset">
<div class="sparkline13-hd">
<div class="main-sparkline13-hd">
<h1>Search <span class="table-project-n"></span> Admission Letter</h1>
<div class="sparkline13-outline-icon">
<span class="sparkline13-collapse-link"><i class="fa fa-chevron-up"></i></span>
<span><i class="fa fa-wrench"></i></span>
<span class="sparkline13-collapse-close"><i class="fa fa-times"></i></span>
</div>
</div>
</div>
<div class="sparkline13-graph">
<div class="datatable-dashv1-list custom-datatable-overright">
<form method="post">
<div class="form-group-inner">
<div class="row">
<div class="col-lg-3">
<label class="login2 pull-right pull-right-pro">KNEC Index Number</label>
</div>
<div class="col-lg-9">
<input id="searchdata" type="text" name="searchdata" required="true" class="form-control" placeholder="Type your Index number">
</div>
</div>
</div>
<div class="form-group-inner">
<div class="login-btn-inner">
<div class="row">
<div class="col-lg-3"></div>
<div class="col-lg-9">
<div class="login-horizental cancel-wp pull-left">
<button class="btn btn-sm btn-primary login-submit-cs" type="submit" name="search">Search</button>
</div>
</div>
</div>
</div>
</div>
</form>
<?php
if(isset($_POST['search']))
{
$sdata=$_POST['searchdata'];
?>
<h4 align="center">Result for "<?php echo $sdata;?>" Index Number </h4>
<table id="table" data-toggle="table" data-pagination="true" data-search="true" data-show-columns="true" data-show-pagination-switch="true" data-show-refresh="true" data-key-events="true" data-show-toggle="true" data-resizable="true" data-cookie="true" data-cookie-id-table="saveId" data-show-export="true" data-click-to-select="true" data-toolbar="#toolbar">
<thead>
<tr>
<th data-field="state" data-checkbox="true"></th>
<th>S.No</th>
<th>Ref Number</th>
<th>Name</th>
<th >Index Number</th>
<th >Admission Letter</th>
<th data-field="action">Action</th>
</tr>
</thead>
<tbody>
<?php
$sql="SELECT * from tbladmission where indexno like '$sdata%'";
$query = $dbh -> prepare($sql);
$query->execute();
$results=$query->fetchAll(PDO::FETCH_OBJ);
$cnt=1;
if($query->rowCount() > 0)
{
foreach($results as $row)
{ ?>
<tr>
<td></td>
<td><?php echo htmlentities($cnt);?></td>
<td><?php echo htmlentities($row->Refno);?></td>
<td><?php echo htmlentities($row->indexno);?></td>
<td><?php echo htmlentities($row->fname);?></td>
<td><?php echo htmlentities($row->admissionletter);?></td>
</tr>
</tbody>
<?php
$cnt=$cnt+1;
} } else { ?>
<tr>
<td colspan="8"> No record found against this search</td>
</tr>
<?php } }?>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Static Table End -->
</div>
</div>
<?php include_once('includes/footer.php');?>
i have already done the login part. the only problem is display the admission letter in form of a pdf for printing or downloading
Source