Okayyyy... the error is line 26 which is $fname = $_POST['fname'];
The error is telling you that the variable $_POST['fname'] does not exist by the time you get down to this line
Your curly brackets around the if($_POST) { ...} section of code end before line 26, so perhaps you need the closing bracket around the whole section of code like this
if ($_POST)
{
... ALL your PHP in here, because otherwise it will get executed anyway regardless of POST data or not
}
If that doesn't work, try changing the line to if (!empty($_POST))