Yes you have couple of errors there.. First edit the deletion bit to this:
if (isset($_POST['submitted']) && !empty($_POST['recno']))
{
$recno = mysql_real_escape_string($_POST['recno']);
$query = "DELETE FROM knowledgebase.document WHERE document_id='$recno'";
mysql_query($query);
echo 'The record was sucessfully removed';
include ('./library/cpfooter.html');
exit();
}
You can move that bit right after the first includes.
You dont need the elseif here because you dont use the $POST['recno'] variable anymore(its used now in that last one). Just:
if (isset($_GET['recno']))
{
$recno = intval($_GET['recno']); // you can use the intval here
}
Fix this next line. You have forgotten to actually print the $recno:
<input type="submit" value="Yes Delete Record"><input type="hidden" name="submitted" value="TRUE" /><input type="hidden" name="recno" value="<?php echo $recno ?>">