Click here to Skip to main content
15,920,508 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi Team

I am struggling to create a view pdf document using php when receipient receives email attachment. My code only view pdf from the browser. How do i link it with front end(html, jquery)?

What I have tried:

// Database Connection 
$conn = new mysqli('localhost','acifinan_acifinan','Finance_01','acifinan_acifinanc');
//Check for connection error
$select = "SELECT * FROM `infopdf`";
$result = $conn->query($select);
while($row = $result->fetch_object()){
  $pdf = $row->filename;
  $path = $row->directory;
  $date = $row->created_date;
  $file = $path.$pdf;

// Add header to load pdf file
header("Content-disposition: inline;     
header('Content-Transfer-Encoding: binary'); 
header('Accept-Ranges: bytes'); 

<iframe src="<?php echo $path.$pdf; ?>" width="90%" height="500px">

// front end using html no jquery yet to call path url for php
<input type="Submit" id="btnNow" class="btn apply-btn mt-30" name="button" value="APPLY NOW">
                                <div id="dialog" style="display: none"></div>

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900