How would I reduce nesting for form validation in PHP?
<p>This is function is taking up a lot of lines on my Functions page. </p>

<p>I can't figure out on how to take it down unless putting them into an array, then using a <code>foreach</code> loop. But I want it to be specific on what is not allowed to be blank.</p>

<pre><code>if ($EmployeeID === "")
{
  echo "EmployeeID Is Blank.";

}
else
{
  if ($Firstname === "")
  {
    echo "Firstname Is Blank.";
  }
  else
  {
    if ($Lastname === "")
    {
      echo "Last Name Is Blank";

    }
    else
    {
      if ($PhoneNumber === "")
      {
        echo "Phone Number Is Blank";

      }
      else
      {
        if ($Address === "")
        {
          echo "Address Is Blank";

        }
        else
        {
          if ($City === "")
          {
            echo "City Is Blank";

          }
          else
          {
            if ($State === "")
            {
              echo "Sate Is Blank";

            }
            else
            {
              if ($Zip === "")
              {
                echo "Zip Is Blank";

              }
              else
              {
                if ($Email === "")
                {
                  echo "Email Is Blank";

                }
                else
                {
                  if ($Password === "")
                  {
                    echo "Password Is Blank";

                  }
                  else
                  {
                    echo "All Success";
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
</code></pre>

<p>The Solution I have Found which takes the lines down, but doesn't give me the exact on what field is left empty is:</p>

<pre><code>$Array = array();
$Array[] = $EmpID;
$Array[] = $FirstName;
$Array[] = $Lastname;
$Array[] = $PhoneNumber;
$Array[] = $Address;
$Array[] = $City;
$Array[] = $State;
$Array[] = $Zip;
$Array[] = $Email;
$Array[] = $Password;   
foreach ($Array AS $Checking) 
{
  if (empty($Checking))
  {
    echo "One Or More Is Left Blank"; 
    exit;
  }
}
</code></pre>
