I am new to PHP. I have completed some tasks for file saving/edit and view the data information from mysql table. I have found some code from web that can export mysql selected data to pdf. but it takes two steps.I need your help to get the information if any user click the record from view page(view.php) it will generate the pdf file of the selected reocrd from mysql table instead of going to next page. currently it is giving all the record output from mysql table instead of giving selected record output. I below is my code so far i have dome.
view.php
<?php
include('ps_pagination.php');
$conn = mysql_connect('localhost','root','xyz');
if(!$conn) die("Failed to connect to database!");
$status = mysql_select_db('test', $conn);
if(!$status) die("Failed to select database!");
$sql = 'SELECT * FROM customer order by CustomerID DESC';
$pager = new PS_Pagination($conn, $sql, 10, 5);
$rs = $pager->paginate();
$result = mysql_query("SELECT * FROM customer order by CustomerID DESC");
while($row = mysql_fetch_array($rs))
{
echo '<td><div align="left">'.$row['CustomerID'].'</td>';
echo '<td><div align="left">'.$row['Name'].'</div></td>';
echo '<td><div align="left">'.$row['Email'].'</div></td>';
echo '<td><div align="left">'.$row['CountryCode'].'</td>';
echo '<td><div align="left">'.$row['Budget'].'</div></td>';
echo '<td><div align="left">'.$row['Used'].'</div></td>';
echo "<td><a href=\"php_pdf_mysql.php?CustomerID=$row[CustomerID]\"><img src='Printer.jpg' width='40' height='30'/></a></td>";
echo '</tr>';
}
?>
php_pdf_mysql.php
// Load MySQL Data
$objConnect = mysql_connect("localhost","root","xyz") or die(mysql_error());
$objDB = mysql_select_db("test");
$strSQL = "SELECT * FROM customer";
$objQuery = mysql_query($strSQL);
$resultData = array();
for ($i=0;$i<mysql_num_rows($objQuery);$i++) {
$result = mysql_fetch_array($objQuery);
array_push($resultData,$result);
}
Your information is highly appreciated.