You are here: Re: [PHP] Re: error checking a null array « PHP « IT news, forums, messages
Re: [PHP] Re: error checking a null array

Posted by "Mark Rees" on 08/01/05 17:49

On 8/1/05, Jack Jackson <jackson.linux@gmail.com> wrote:
>
> Jochem Maas wrote:
> <snip>
> >
> > wtf are you smoking Jack? every checkbox that was checked will exist in
the
> > $_POST array set with the value you gave it (I alway set a chekcboxes
> > value to 1
> > because the values mere existance in the submitted data indicates it's
> > chevckbox
> > was checked), if a checkbox does not exist in the $_POST array it
> > wasn't checked!!!
>
> Oh, how I wish I were smoking something :) !
>
> > imagine you have 10 checkboxes named 'cb1' thru 'cb10' each with a value
> > of '1',
> > upon submitting the form they are in, your script sees the following in
> > the $_POST
> > array...
> >
> > $_POST = array('cb1' => '1', 'cb9' => '1', 'cb10' => '1');
> >
> > which tells you 3 checkboxes were checked... namely 'cb1', 'cb9' and
'cb10'
> > now how hard is it to determine which we're not checked?
> >
>
> Well, for me, it is - because I don't know the names of the other check
> boxes which were not checked because they were dynamically created, and
> I don't have the knowledge sufficient to pass the NAMES of all
> checkboxes through to $_POST so that I can search through and see which
> have been answered and which ones not.
>
>
>
> > maybe I'm not seeing the problem but I get the impression that you are
> > over complicating things regarding checkbox.
>
> As always this is hugely possible.
>
>
> JJ
>


You can pass those names in a hidden input field in the form,
something like this:
<input type="hidden" name="checkboxes" value="one box, two box, three
box, four!">

----------------------

Yes, or you can make your life easier and use radio buttons instead - the
name:value is always passed without any need for the messing about which
checkboxes bring. However, if you wish to use checkboxes, Jochem and Dotan
are showing you the way.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация