473,405 Members | 2,373 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

It would be nice

I think this capability is lacking in php.

Suppose there is a group of checkboxes all named "procedure". Doing a
$_POST['procedure'] returns all the ones that are checked and not the
ones that are not checked. It would be nice if there were a way to get
them all and then discern which were checked. [Note: This can be done
in Javascript with document.getElementsByName('procedure') and then
testing whether each of the child nodes is checked].

This post arose from a question I had posted in comp.lang.mysql. I have
a group of checkboxes and I would like to be able to put them all into
the database table, specifying which was checked and which was not. The
only way I can see doing that is to (a) sort the array by ID that is
returned from the $_POST and (b) compare each element in it with a list
of all the checkboxes ordered by ID used to generate the form. A little
tedious, but it would work.
Nov 13 '08 #1
3 1430
sheldonlg pisze:
I think this capability is lacking in php.

Suppose there is a group of checkboxes all named "procedure". Doing a
$_POST['procedure'] returns all the ones that are checked and not the
ones that are not checked. It would be nice if there were a way to get
them all and then discern which were checked. [Note: This can be done
in Javascript with document.getElementsByName('procedure') and then
testing whether each of the child nodes is checked].
It has nothing to do with PHP.

--
Radek N.

Nov 13 '08 #2

<sheldonlgwrote in message
news:uZ******************************@giganews.com ...
>I think this capability is lacking in php.

Suppose there is a group of checkboxes all named "procedure". Doing a
$_POST['procedure'] returns all the ones that are checked and not the ones
that are not checked. It would be nice if there were a way to get them
all and then discern which were checked. [Note: This can be done in
Javascript with document.getElementsByName('procedure') and then testing
whether each of the child nodes is checked].

This post arose from a question I had posted in comp.lang.mysql. I have a
group of checkboxes and I would like to be able to put them all into the
database table, specifying which was checked and which was not. The only
way I can see doing that is to (a) sort the array by ID that is returned
from the $_POST and (b) compare each element in it with a list of all the
checkboxes ordered by ID used to generate the form. A little tedious, but
it would work.
That goes to design or your script and implementation of the browser - which
is simply conforming to the w3c standard. You can define, whether from a
static array or from a db, what checkboxes are going to be shown. From
there, all you have to do is an array_intersect and array_diff to see what
boxes were and were not checked.

Other than making a mountain from a mole hill, this is a non-issue and
doesn't relate to php at all. If I've got an options page with dozens of
checkboxes, I don't want to consume bandwidth or processing time toting
superfluous information back and forth between client and server. A better
design on your end will help you appreciate the *good* implementation of the
w3c spec concerning checkboxes.

If you must mangle things, or if this will help you qwell your bitching, why
not use javascript on submit and simply create hidden inputs that coorespond
to each checkbox and whos values are either 1 or 0 depending on the checkbox
state at the time of submit. It would be nice if more people thought about
things before complaining to group of people who couldn't care less about
*off* topic, self-imposed shortcomings. THAT is what would be nice.
Nov 13 '08 #3
On Thu, 13 Nov 2008 08:31:13 -0500, sheldonlg <sheldonlgwrote:
I think this capability is lacking in php.

Suppose there is a group of checkboxes all named "procedure". Doing a
$_POST['procedure'] returns all the ones that are checked and not the
ones that are not checked. It would be nice if there were a way to get
them all and then discern which were checked. [Note: This can be done
in Javascript with document.getElementsByName('procedure') and then
testing whether each of the child nodes is checked].
DOM != POST/GET request.
This post arose from a question I had posted in comp.lang.mysql. I have
a group of checkboxes and I would like to be able to put them all into
the database table, specifying which was checked and which was not. The
only way I can see doing that is to (a) sort the array by ID that is
returned from the $_POST and (b) compare each element in it with a list
of all the checkboxes ordered by ID used to generate the form. A little
tedious, but it would work.
Sounds like you're trying to use the wrong approach. This has
nothing to do with PHP and everything to do with how the (X)HTML spec
defines "successful controls."[1] Since your "problem" is actually
standard HTML behavior, it is the same with any language processing
the request.

Before attempting to fault a language, you should attempt to better
understand the issue at hand.

[1] <URL:http://www.w3.org/TR/html4/interact/...ml#successful-
controls>
--
Curtis
$email = str_replace('sig.invalid', 'gmail.com', $from);
Nov 13 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Otto Haldi | last post by:
Hello to all I'm using PHP since a few week. I like to know how php programmers are making so nice border to displaying MySQL table? I like to make a border with rounded corner. Could...
4
by: Dominik | last post by:
I'm looking for some nice-looking DHTML select boxes (combo boxes). Someone knows where can I find it?
0
by: Derek LaZard | last post by:
The ClipBoard Ring in the ToolBox is really a nice feature. Renaming, copying/moving within clipboard, and categorizing is a nice and frequently used feature... :) Derek LaZard
4
by: Reiter Peter | last post by:
hi can someone tell me, how i can create a really nice looking app? with nice effects do i need for this MDX (managed directx), or is it also possible with gdi+? for instance, windows media...
10
by: Justin Dutoit | last post by:
Hey. I'm still not experienced at error handling, and I need to know if Try.. Catch blocks are meant to be used to handle errors in your own app, ie bugs. Or, are they only for external things like...
8
by: Spleenwort | last post by:
With regard to XML comments in c#. I think that #regions should be self-documenting relative to XML comments or that a <region> tag should be defined and auto-inserted when you type #region...
7
by: shapper | last post by:
Hello, Does anyone knows where can I find some nice styled CSS tables? Thanks, Miguel
0
by: Pretty nice site, wants to see much more on it!,Pr | last post by:
Pretty nice site, wants to see much more on it!,Pretty nice site, wants to see much more on it!,Pretty nice site, wants to see much more on it!
3
by: WebCM | last post by:
How to apply nice URL-s into CMS? 1. Should we use nice urls for every page? 2. Do we need to put a FULL path into <a href="">? 3. What is faster and better? a) 10 rules in .htaccess...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.