Solved

getting checkbox data form a html - php form

Posted on 2016-10-17
5
84 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 109

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

856 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