Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8851845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:15:21+00:00 2026-06-14T13:15:21+00:00

This is function is taking up a lot of lines on my Functions page.

  • 0

This is function is taking up a lot of lines on my Functions page.

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

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";
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

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

$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;
  }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T13:15:23+00:00Added an answer on June 14, 2026 at 1:15 pm
    try{
        if(empty($EmployeeID)){
            throw new Exception('EmployeeID Is Blank.');
        }elseif(empty($Firstname)){
            throw new Exception('Firstname Is Blank.');
        }elseif(empty($Lastname)){
            throw new Exception('Lastname Is Blank.');
        }elseif(empty($PhoneNumber)){
            throw new Exception('PhoneNumber Is Blank.');
        }elseif(empty($Address)){
            throw new Exception('Address Is Blank.');
        }elseif(empty($City)){
            throw new Exception('City Is Blank.');
        }elseif(empty($State)){
            throw new Exception('State Is Blank.');
        }elseif(empty($Zip)){
            throw new Exception('Zip Is Blank.');
        }elseif(empty($Email)){
            throw new Exception('Email Is Blank.');
        }elseif(empty($Password)){
            throw new Exception('Password Is Blank.');
        }
        echo 'All Success';
    }catch(Exception $e){
        echo $e->getMessage();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi What paratemeter I need to pass to this function. It is taking 00c0c0c0
Taking a JavaScript object with 4 properties: function Object() { this.prop1; this.prop2; this.prop3; this.prop4;
Taking the jQuery framework for example, if you run code like this: $(document).ready(function init()
This function works fine if I disable errors. But I have to solve them.
This function works fine: std::string get_str() { return std::get<0>( make_tuple(std::string(hi)) ); } But if
This function is in a Class file in App_Code folder Public Shared Function CRUD(ByVal
This function works as it should, window.setInterval(function(){ var active = $('#frontpageControls a.active'); var next
This function only works once, when I click an anchor element again, nothign happens.
This function gives error: function RefreshGrid(){ window.location.href=Form_ElameMamoreBazdid.aspx; }
This function sets up the Magento Grid to display a list of filenames with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.