Reply to Re: How do get the state of checkboxes in php?

Your name:

Reply:


Posted by The Natural Philosopher on 09/07/07 23:38

Kelsey Sigurdur wrote:
> On Fri, 07 Sep 2007 13:06:34 -0500, Lorenzo Thurman wrote:
>
>> I have a group of checkboxes drawn by javascript and I need to get each
>> of their states into PHP after submitting the page. I should think I
>> could get them in a POST, but that fails. Anyone have any ideas?
>> TIA
>
> Use an additional hidden input, with the same name as the checkbox and a
> value of 0. In almost all cases you'll want the hidden input to appear in
> the source before the actual checkbox.
>
> When the form is submitted, if the checkbox has been checked, it's value
> will override the hidden input of the same name. If it hasn't been checked
> the hidden input (with its value of 0) will be in the $_POST array.
>
> AFAIK this is the only way to do it as unchecked checkboxes are not passed
> to POST at all.
>

This is the generic way to do javascript/php dialogue.

EITHER set your submit button to invoke javascript and cahin to the next
page using get variables.. i.e. replace.window("myurl?myvar=Myvalue");

OR set up a POST form with id hidden variables, do a
getElementbyId('myvar').value="Myvalue";
and then submit()....

Syntax NOT guaranteed ;-)

[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

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