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 7672061
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T16:11:59+00:00 2026-05-31T16:11:59+00:00

I am just starting to learn a little about PHP; having trouble with the

  • 0

I am just starting to learn a little about PHP; having trouble with the following code using IF || to check multiple statments from a form. here is my code; can someone give me some pointers?

  <html>
<body>
<?php
if (((($_POST['first_name']== null) || ($_POST['last_name']== null) || ($_POST['email']== null) || ($_POST['comments']== null)))) {
echo "Error one or more fields have been left empty please complete all details marked with a *.";}

else {

echo $_POST['first_name']; <br />
echo $_POST['last_name']; <br />
echo $_POST['email']; <br />
echo $_POST['telephone']; <br />
echo $_POST['comments']; <br />
}
?>
</body>
</html>
  • 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-05-31T16:12:00+00:00Added an answer on May 31, 2026 at 4:12 pm

    You may be better off with:

    if( !$_POST['first_name']) echo "You left the First Name blank";
    elseif( !$_POST['last_name']) echo "You left the Last Name blank";
    elseif( !$_POST['email']) echo "You left the Email blank";
    elseif( !$_POST['telephone']) echo "You left the Telephone blank";
    elseif( !$_POST['comments']) echo "You left the Comments blank";
    else {
        // do magic here.
    }
    

    You can customise the error messages, of course, and maybe do some stuff like highlight the boxes that were left empty to allow the user to see more clearly what they missed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

im just starting to learn about sockets and i have been given this code,
I'm just starting to learn PHP and am using the W3 Schools tut. In
I'm just starting to learn intel assembly and I'm having trouble with this simple
I'm starting to learn a little Flex just for fun and maybe to prove
Just starting to learn ASP.NET (C#) and I am using Visual Studio 2008. I
I am just starting to learn php, how would I initiate a echo statement
I'm just starting to learn about jQuery. I'm more of a html+css web designer
I'm just starting to learn F# using VS2010 and below is my first attempt
I am just starting to learn a bit about the entity framework and don't
I am starting to learn Perl and this is just a basic little for

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.