Solved

getting checkbox data form a html - php form

Posted on 2016-10-17
5
52 Views
Last Modified: 2016-10-17
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
Comment
Question by:Braveheartli
5 Comments
 
LVL 11

Assisted Solution

by:Radek Baranowski
Radek Baranowski earned 250 total points
ID: 41846282
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
 
LVL 1

Accepted Solution

by:
Nainudhin Afroz earned 250 total points
ID: 41846366
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
 
LVL 1

Author Closing Comment

by:Braveheartli
ID: 41846546
thank you
0
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 41846689
@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
 
LVL 1

Author Comment

by:Braveheartli
ID: 41847013
Thank you Ray_Paseur
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

These days socially coordinated efforts have turned into a critical requirement for enterprises.
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now