Solved

getting checkbox data form a html - php form

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

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses four methods for overlaying images in a container on a web page
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

728 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