Display single record in a PDF page using variable from Query string

We can generate PDF page by taking data from the query string. This way we will pass variables to our script and using that we will generate our PDF page.


We will create a page to show mark obtained by each student by using a single PHP script. Our PHP script will receive student ID from query sting and generate the mark sheet of the student by taking data from the table.

Displaying list of students in a pdf document.

We will be using one similar student list and then on clicking on the name column of the record we will display the Mark sheet of the student. The link we will click will pass the student number or ID to our script.
2 Max Ruin
3 Arnold
4 Krish Star
5 John Mike
6 Alex John
7 My John Rob
8 Asruid
9 Tes Qry
10 Big John
// connection to database
require "config.php";
$pdf = new FPDF(); 
//collect student id from URL 
$q="select id,name,class,social,science,math,
(social + science + math) AS total from student3 where id=:id";

$row = $count->fetch(PDO::FETCH_OBJ);

// First header column 
$pdf->Cell(30,10,'MARK SHEET',0,0,L,false);









Download Script

Inside the zip file you can open index1.php file to list all students in PDF , click the mark column to dispaly the mark sheet of individual student ( index-pdf-mark.php is included inside the zip file.)

Check the readme.txt file for more detail.


Post your comments , suggestion , error , requirements etc here .

We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2020 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer