Reply to Re: [PHP] Re: array of checkbox values

Your name:

Reply:


Posted by Philip Hallstrom on 01/12/06 00:45

> Would it be enough to set a key for each checkbox, for example explicitly
> say:
> checkbox[1]
> checkbox[2]
> checkbox[3]
> then a non checked box will have an empty string as a value, whereas the
> checked ones will have a value of 'Y'.

Nope. That's the problem. If a checkbox is unchecked the browser doesn't
need to send it all when it submits the server...

an example:
http://www.pjkh.com/~philip/test/check.php

>
> Sjef
>
> "David Dorward" <dorward@yahoo.com> schreef in bericht
> news:31.E5.29075.A1D75C34@pb1.pair.com...
>> Sjef Janssen wrote:
>>
>>> 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.
>>
>> That's how HTML forms work. The general solution is to set the value of
>> the
>> checkbox to describe what the checkbox is (for example, the row id of the
>> database record that the checkbox is associated with). Then you can loop
>> through and see which values were submitted.
>>
>> --
>> David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
>> Home is where the ~/.bashrc is
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

[Back to original 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

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