| | |
get checkbox value
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
if you are posting it using a PHP form
then you will use something like that
($_POST['checkboxname] == "ON")
if you want to see what checkboxes are checked you have to declare them as an array then loop through them
see this link
http://www.daniweb.com/techtalkforums/thread62312.html
then you will use something like that
($_POST['checkboxname] == "ON")
if you want to see what checkboxes are checked you have to declare them as an array then loop through them
see this link
http://www.daniweb.com/techtalkforums/thread62312.html
The day will soon come.
•
•
Join Date: Oct 2006
Posts: 7
Reputation:
Solved Threads: 1
Or if you are talking about a group of checkboxes with the same name you would do something like this:
page_html.php
page_php.php
basically just turn it into an array and dump the crap into a db. Notice that you have to "serialize" the data first and don't forget to "unserialize" when you are taking the data back out of the db (selecting).
You will then most likely have to implement a loop when you take the "crap" out of the db (as it will be in an array). The following link is a really good article on this, I would check it out.
Storing form array data to MySQL using PHP
page_html.php
PHP Syntax (Toggle Plain Text)
<form method="post" action=""> <input type="checkbox" id="things[]" value="red"> Cat<br> <input type="checkbox" id="things[]" value="blue"> Mouse<br> <input type="checkbox" id="things[]" value="green"> Car<br> <input type="checkbox" id="things[]" value="yellow"> DaniWeb </form>
page_php.php
php Syntax (Toggle Plain Text)
<?php $things = serialize($_POST['things']); $query = "INSERT INTO table(things) values($things)"; mysql_query($query) or die(mysql_error()); ?>
basically just turn it into an array and dump the crap into a db. Notice that you have to "serialize" the data first and don't forget to "unserialize" when you are taking the data back out of the db (selecting).
You will then most likely have to implement a loop when you take the "crap" out of the db (as it will be in an array). The following link is a really good article on this, I would check it out.
Storing form array data to MySQL using PHP
![]() |
Similar Threads
- how do i get more than one checkbox being checked (ASP)
- checkbox values calculation with PHP (PHP)
- hide checkbox in grid appropriately (ASP.NET)
- recordset from multiple checkbox values (ASP)
- checkbox values (JSP)
- Adding a checkbox column dynamically (C#)
Other Threads in the PHP Forum
- Previous Thread: Table Populated by Database when picked by menu
- Next Thread: html checkboxes...
| Thread Tools | Search this Thread |
# 5.2.10 alexa apache api array beginner binary broken cakephp checkbox class clean clients cms code cron curl database date directory display dissertation dynamic echo echo$_get[x]changingitintovariable... email encode error fairness file files folder form forms function functions google href htaccess html image images include indentedsubcategory insert ip javascript joomla legislation limit link local login mail memberships menu mlm multiple multipletables mysql mysqlquery newsletters oop open paypal pdf persist php problem provider query radio random recursion remote rss script search server sessions simple sms sockets source space spam sql syntax system table tutorial update upload url validator variable video web youtube





