You are here: Re: Programmatically setting a radio buttones « PHP Programming Language « IT news, forums, messages
Re: Programmatically setting a radio buttones

Posted by Kimmo Laine on 11/21/06 08:00

"IchBin" <weconsul@ptd.net> wrote in message
news:x_-cnfV-DsKWwf_YUSdV9g@ptd.net...
>I am trying to programmatically set a radio button in a table of radio
>buttons. I have two problems with the code below:
>
> 1 - I can not prepare the <Form> statement to be printed by php. (syntax
> of the hyphens, quotes) my fault!
>
> 2 - If I delete the <Form> and </Form> statements I can build the table
> of radio buttons correctly, HTML wise. The fifth radio button has
> 'checked=True'. The problem is even though I set radio button 5 to be
> checked only the last radio button is checked when it is displayed on the
> screen. But viewing the page code says it should be the fifth radio
> button.
>
> Anybody have some ideas, I'm lost.



You're not using the checked attribute correctly. It has no value true or
false. If you wish to assign a value to it (in xhtml you MUST assign a value
to it) the value is "checked". However the value is not evaluated ever, it's
just a dummy placeholder. Just the presence of the checked attribute means
that the button should be checked, weather it's value is set to "true",
"false" or "barbara streisand". When you have a zillion buttons that all are
checked, the last one remains checked. This is what you are experiecing

right:
<input type="radio" name="foo" checked="checked" />
<input type="radio" name="foo" />
<input type="radio" name="foo" />

wrong:
<input type="radio" name="foo" checked="true" />
<input type="radio" name="foo" checked="false" />
<input type="radio" name="foo" checked="donald duck" />
(All are checked)

Only set the checked attiribute to the element you want checked, and it's
value should be "checked", and not set it to any of the other elements.

--
"Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk
http://outolempi.net/ahdistus/ - Satunnaisesti pδivittyvδ nettisarjis
spam@outolempi.net | rot13(xvzzb@bhgbyrzcv.arg)

 

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

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация