Solved

getting checkbox data form a html - php form

Posted on 2016-10-17
5
94 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 110

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

749 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