Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Jun 2005
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    how to auto check the radio button???

    i have made a edit section for the members where the every text field is filled by fetching the respective data and i m not able to check the one of the radio button field ie male or female......Please tell me how to check the one...

  • #2
    teh Moderatorinator
    Join Date
    Sep 2004
    Location
    USA
    Posts
    2,472
    Thanks
    4
    Thanked 40 Times in 40 Posts
    By using the checked property:

    <input type="radio" name="foo" checked>

  • #3
    Regular Coder
    Join Date
    Aug 2004
    Posts
    280
    Thanks
    0
    Thanked 0 Times in 0 Posts
    perhaps

    Code:
    <input type="checkbox" name="male" <?= $person['male']?'checked':'': ?> >
    ?

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    XHTML Compliant:
    Code:
    <input type="radio" name="gender" value="male"<?php !empty($info['male']) ? ' checked = "checked"' : '';?> />
    Edit:
    Oh yeah, $info contains the variables you need. I'm not sure what you use, but I think you get the jist of it
    Last edited by Fou-Lu; 06-28-2005 at 04:22 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •