So would like to look up a pdf in my directory with a part number (pnumber) and if it is there, I would like for it to embed it but if it is not, I would like for a defeault pdf to be embeded. Would the code below be the correct way of doing so?
<?php
if (isset($_POST['submit']))
echo $_POST['pnumber'];
?>
<form action="index.php" method="post">
Search: <input type="text" name="pnumber">
<input type="submit" name="submit" id="button" value="Find Alert">
<br />
</form>
<?php
$filename = '/PDFs/pnumber.pdf';
if (file_exists($filename)) {
echo "<p>
<embed src="PDFs/$filename.pdf" width="100%" height="400" alt="pdf" pluginspage="http//www.adobe.com/products/acrobat/readstep2.html" />
</p>";
} else {
echo "<p>
<embed src="PDFs/QAAlert.pdf" width="100%" height="400" alt="pdf" pluginspage="http//www.adobe.com/products/acrobat/readstep2.html" />
</p>";
}
?>