You are here: Re: array of checkbox values « PHP « IT news, forums, messages
Re: array of checkbox values

Posted by "Sjef" on 01/12/06 11:10

Interesting way to solve the problem. I thought about checking whether the
keys are present (if not the checkbox is set to "N".)
I wil definitily try this option as well.
Thxs all!
Sjef

"Al" <news@ridersite.org> schreef in bericht
news:B9.FE.29075.D79A5C34@pb1.pair.com...
> Sjef Janssen wrote:
>> Hallo,
>> I have a form with a number of checkboxes grouped together. The value of
>> these boxes is stored in an array: $used[]. Now I found that the value of
>> checked boxes (value = 'Y') are stored in the array while non checked
>> boxes
>> are not stored at all. This makes the array incomplete as I want to have
>> all
>> checkbox values in the array.
>> For example: for 4 checkboxes the values are
>> checkbox 1: array index = 0 value = "Y"
>> checkbox 2: array index = 1 value = "Y"
>> checkbox 3: value = "N" : it does not occur in the array
>> checkbox 4: array index = 2 value = "Y"
>>
>> Is there a way to, as it were, complete the array and have all values
>> stored, even the "N" values? So that array index 2 has a value of "N",
>> and
>> array index 3 is "Y".
>>
>> Thxs
>>
>> Sjef
>
> Seems like I recall solving this problem. It's been a long time, so
> you'll need to try it.
>
> For each checkbox set these two
> <input type="hidden" name="foo" value="no"><input type="checkbox"
> name="foo" value="yes">
>
> You'll get $_POST[foo] as "no" or "yes"

 

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

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