Basically, for each form element you have, there will be a corresponding $_POST variable.
<?php
if(isset($_POST[test])){
if($_POST[text] == ""){
echo("Please fill in the field text");
} else if($_POST[text2] == ""){
echo("Please fill in the field text2");
} else {
echo("Form filled in correctly");
}
}
?>
<form name="test" action="<?PHP echo $PHP_SELF;?>" method="post">
<input type="text" name="text">
<input type="text" name="text2">
<input type="submit" name="test" value="test">
</form>