• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 110
  • Last Modified:

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 />
0
Braveheartli
Asked:
Braveheartli
2 Solutions
 
Radek BaranowskiFull-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.
0
 
Nainudhin AfrozCommented:
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.

https://www.formget.com/php-checkbox/
0
 
BraveheartliMarketingAuthor Commented:
thank you
0
 
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:
https://www.experts-exchange.com/articles/5450/Common-Sense-Examples-Using-Checkboxes-with-HTML-JavaScript-and-PHP.html
0
 
BraveheartliMarketingAuthor Commented:
Thank you Ray_Paseur
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now