In each case you have left out the closing quote on a preceding line's echo statement. A text editor with syntax highlighting will make those things easier to see, just as using this site's [noparse]
...
[/noparse] bbcode tags will help, too (quoted strings are highlighted in red here):
<?php
if ($_POST [ "fname"] == "Joe") {
echo "<p>Hi $POST ['fname'] </p>;
}
else {
echo "<h2>Your name's not Joe, so you cant enter the website.</h2>"
}
?>
<?php
//check to make sure the first name is wequal to Joe before granting access
if ($_POST ["fname"] == "Joe")
{
echo "<p>";
echo "Hi";
echo $_POST ['fname'];
echo "</p>;
}
else
{
echo "<h2>";
echo "Your name's not Joe, so you can't enter the website!";
echo "</h2>";
}
?>