Hmmm, the question is why do you want to initialize your variables with empty values?
How about trying this?
1- Separate your PHP file just for the sake of understanding what's going on in your scripts and different pages.
2- Putting the name of PHP file in the action attribute in the form. E.g <form action="validation.php" method="POST">
3- Try this:
<?php
// define variables and initialize with empty values
$fname = $_POST["fname"];
$lname = $_POST["lname"];
$pass = $_POST["pass"];
$errorMsg= "Missing ";
if (empty($fname) ) {
echo $errorMsg + "First name";
}else if (empty($lname) ){
echo $errorMsg + "Last name";
}else if (empty($pass) ) {
echo $errorMsg + "Password";
}else{
echo "Success";
}
?>
Save the above code in a new file called validation.php