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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:13:20+00:00 2026-06-15T18:13:20+00:00

I am having what seems to be a very easy issue to resolve in

  • 0

I am having what seems to be a very easy issue to resolve in my mind. I have an html form with checkbox groups and i want to be able to enforce a selection of checkboxes. At this point I just want to write an error that will come up with echo if none of the checkboxes are selected from a group. I am sending the checkbox array through a mysql query and when nothing is selected I’m getting an empty page. My confusion is how to write the PHP code to return an error. I’ve tried

if (empty($_GET){
echo "ERROR" ;}

and

if (empty($color)){
echo "ERROR" ;}

Maybe I’m just brain dead but this seems like it should work. Here is my html code that is currently working for the checkboxes.

<input type="checkbox" name="color[]" value="Black">Black
<input type="checkbox" name="color[]" value="Blue">Blue
<input type="checkbox" name="color[]" value="Brown">Brown
<input type="checkbox" name="color[]" value="Green">Green 
<input type="checkbox" name="color[]" value="Grey">Grey
<input type="checkbox" name="color[]" value="Orange">Orange 
<input type="checkbox" name="color[]" value="Pink">Pink
<input type="checkbox" name="color[]" value="Purple">Purple
<input type="checkbox" name="color[]" value="Red">Red
<input type="checkbox" name="color[]" value="Teal">Teal
<input type="checkbox" name="color[]" value="White">White
<input type="checkbox" name="color[]" value="Yellow">Yellow
<br>
<input type="checkbox" name="pattcat[]" value="Home Decor">Home Decor
<input type="checkbox" name="pattcat[]" value="Children">Children
<input type="checkbox" name="pattcat[]" value="Tops Women">Tops Women
<input type="checkbox" name="pattcat[]" value="Accessories">Accessories
<input type="checkbox" name="pattcat[]" value="Lace">Lace
<input type="checkbox" name="pattcat[]" value="Tops Men">Tops Men
<br>
  • 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-15T18:13:21+00:00Added an answer on June 15, 2026 at 6:13 pm

    Have you tried if( empty($_GET['color']))? Just because it’s an array doesn’t mean it’s any different to a normal GET variable.

    Also, make sure the form method is GET, rather than POST.

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

Sidebar

Related Questions

The problem I am having is probably very simple to solve, yet it seems
It seems this should be easy but I'm having a lot of difficulty using
I have the notion that this is very easy and over-documented, but I have
I have a very strange issue that only affects webkit browsers for some reason,
I'm having a very hard time trying to come up with html/css for a
I seem to be having a very frustrating time with an inherited class calling
My friend seems to be having some trouble with ABAP. Here's a copy of
I'm having a problem that only seems to happen on my Lenovo Thinkpad Tablet
I am having a strange problem which seems to be a problem of ipv6
Ok this seems so silly but I'm having some trouble getting this to work.

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.