/    Sign up×
Community /Pin to ProfileBookmark

setting a radio button as selected ?

I have the following code:

[code=php]
<b>Add pictures ?</b>
Yes <input type=”radio” name=”rad_pict” value = “y” />
No <input type=”radio” name=”rad_pict” value = “n” selected /><br>

[/code]

And I want to have the no value as the default
how do i pre-select it ?

Thanks ?
Dave

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@madddidleyJul 29.2005 — <form>

<b>Add pictures ?</b>

Yes <input type="radio" name="rad_pict" value="y"/>

No <input type="radio" name="rad_pict" value="n" selected="selected" /><br>

<input type="submit" value="Submit"/>

</form>

I guess thats how you would do it.


www.maddDidley.com
Copy linkTweet thisAlerts:
@zincJul 30.2005 — You use CHECKED with radio buttons and SELECTED with selection boxes. The effect you want is achieved with the following piece of code:

<b>Add pictures ?</b>

Yes <input type="radio" name="rad_pict"/>

No <input type="radio" name="rad_pict" CHECKED/><br>
Copy linkTweet thisAlerts:
@bokehJul 30.2005 — You use CHECKED with radio buttons and SELECTED with selection boxes. The effect you want is achieved with the following piece of code:

<b>Add pictures ?</b>

Yes <input type="radio" name="rad_pict"/>

No <input type="radio" name="rad_pict" CHECKED/><br>[/QUOTE]
He is using XHTML input tags and there is no shortag for checked in xhtml so he is going to need
[code=html]<b>Add pictures ?</b>
Yes <input type="radio" name="rad_pict" />
No <input type="radio" name="rad_pict" checked="checked" />[/code]
Otherwise the validator will reject the code.
×

Success!

Help @DaveinLondon spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.29,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...