HI! What I am trying to do is first generate a list of names and links which link to corresponding PDF documents on my server based on user input. Outputing the list seems to work fine, however I cant seem to come up with a way to point the generated links at the correct PDF document. I cant seem to mix the query script with the script that opens and outputs pdf files, i guess session_start() and the headers required for pdf documents dont like each other. im really lost as of what i can do with this, any help at all would be great. Here are both the scripts i was messing with
<?php
// this script varifies your session
// and then generates a list of names
// and links, the links open corresponding
// pdf docuemnts
session_start();
if (session_is_registered("valid_user"))
{
include ("header3.php");
}
else
{
echo "<p>You are currently not logged in.</p>";
echo "<p>Please return to the login page.</p>";
exit;
}
mysql_connect ($host, user$, $pass);
$result = mysql_db_query ("$db","SELECT * FROM articles WHERE name = '$name' || idnum = '$idnum' || fileloc = '$fileloc'");
while ($row = mysql_fetch_array ($result)) {
print "idnum: ".$row["idnum"]."
\n";
print "<br>";
echo "name: ".$row["name"]."
\n";
print <"INPUT TYPE=SUBMIT VALUE="Search" NAME=".$row[fileloc]">
print "<br>";
}
mysql_free_result ($result);
?>
<?php
// This is the script which opens the pdf and outputs it contents
header("Content-type: application/pdf");
header("Content-disposition: inline; filename=test.pdf");
header("Content-length: " . filesize("test.pdf"));
$fd = fopen("$fileloc.pdf", "r");
fpassthru($fd);
fclose($fd);
?>