getting checkbox data form a html - php form

I have a lot of check boxex on my form. The users can check the boxes and submit it, ( I use post method)
then I need to get all the data that have been posted by the users. But mostly I have many checkboxes posted at the same time,
How can I get all the checkboxes which has value = 1 and print it on the screen?

I assign my variable to checkbox name so that I would know which one is checked.

<input name=$bayikodu type=checkbox value=0 />
Who is Participating?
Nainudhin AfrozConnect With a Mentor Commented:
As Radek Baranowski told, you can put all the checkbox into an array and then check if they are selected.

You can refer to this post.
Radek BaranowskiConnect With a Mentor Full-stack Java DeveloperCommented:
Most straightforward approach would be putting all checkboxes into an array, iterate them for display purposes and then iterating again after post to check whether they have been ticked.
BraveheartliMarketingAuthor Commented:
thank you
Ray PaseurCommented:
@Braveheartli: Just a thought for going forward... We have a lot of good learning resources here at E-E, if you just make a quick search for them.  These have been vetted by the E-E community.  Example:
BraveheartliMarketingAuthor Commented:
Thank you Ray_Paseur
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.