Jump to content

PHP and checkboxes


This topic is 4915 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hey there,

My solution contains records of different categories: The Category field can hold e.g. "Library item", "Periodical", "Internal Knowhow" and many more. (A record has one category only.)

The Find screen that is being offered through a PHP solution contains a field where users can search the Category field using two checkboxes: When they tick "Library item", they find library items; when they tick "Periodical", the find periodicals; and when they check both, they find records of both categories.

My problem now is, if a user does not check any of the checkboxes he finds all the records that belong to other categories. But what I have in mind is that if the user does not choose between "Library item" or "Periodical" he does not receive any results at all (as the mentioned two categories are the only ones he is entitled to view).

Is there a way to implement this for a user like me who does not have too much knowledge of PHP?

Thanks for your input,

Michael

Link to comment
Share on other sites

  • 3 weeks later...

Not sure if you ever figured this one out or not...

Before performing your find, test the checkbox's value with something like this...

if( $POST['checkbox1']=='' and $POST['checkbox2']=='' ) {

//don't perform find

}

Link to comment
Share on other sites

This topic is 4915 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.