The following code fetches around 100 records of judgment from mysql table in the form of a list which contains case nos., title, etc. I have a separate folder on desktop which contains pdf files of these judgments. This folder or files in it has no link with mysql table. Is there any way that when user click on any of the case no., judgment of such case no. would open in the browser or through pdf reader.
I don't know how to link files lying in the folder on desktop to the item in the list dynamically, which means each item of the list on click should open the pdf file corresponding to it.
<?php
$conn = mysqli_connect('localhost', 'root', '', '');
$sql="SELECT case when ordertype=1 then 'Judgement' else
'Order' end ordertype, casetype, caseno, year, petitioner,
respondent, firstcoram, secondcoram, thirdcoram, fourthcoram,
fifthcoram, cavon, pronouncementdate, questionoflaw FROM `cav`
WHERE writtenby ='1' and ordertype='1' and
CAST(`pronouncementdate` AS CHAR(10)) != '0000-00-00' ORDER BY
pronouncementdate ASC";
$query = $conn->query($sql);
$result = mysqli_query($conn, $sql);
$i=0;
$date = date('d-m-Y');
echo '<BR><BR><BR><BR>
<h2 align="center">Judgement delivered by as on
'.$date.'</h2>
<CENTER><table border=".05" cellspacing="0" cellpadding="3">
<tr>
<th>S.No.</th>
<th>Case No.</th>
<th width="17%" >Cause Title</th>
<th>Question of Law</th>
<th>Coram</th>
<th>Judgment/ Order</th>
<th>CAV Date</th>
<th>Judgment Pronounced On</th>
</tr> ';
while($row = mysqli_fetch_array($result)){
$i++;
echo"
<tr>
<td>".$i."</td>
<td>".$row["casetype"]." ".$row["caseno"]."/".$row["year"]."
</td>
<td>".$row["petitioner"]."<br>Vs.<br>".$row["respondent"]."
</td>
<td>".$row["questionoflaw"]."</td>
<td>".$row["firstcoram"]."<br>".$row["secondcoram"]."
<br>".$row["thirdcoram"]."<br>".$row["fourthcoram"]."
<br>".$row["fifthcoram"]."</td>
<td>".$row["ordertype"]."</td>
<td>".date_format(date_create($row["cavon"]),'d-m-Y')."</td>
<td>".date_format(date_create($row["pronouncementdate"]),'d-m-
Y')."</td>
</tr>
";
}
echo"
</CENTER></table>";
?>
I wish that Case No. should be made clickable (having hyperlink) and when the user clicks any of the Case No. appears in the list, it should open the corresponding pdf file lying in the folder available on my desktop.