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 2 of 2
  1. #1
    Regular Coder
    Join Date
    May 2005
    Posts
    224
    Thanks
    1
    Thanked 0 Times in 0 Posts

    GET value into radio button

    I thought I knew how to do this....

    If I have a form with a set of radio buttons named "test", and my url includes:

    ?test=1

    shouldn't the radio button in the set with the value "1" be selected? Or am I forgetting something?

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    You need to tell it to be checked. Having a value of 1 doesn't mean its automatically checked. If you are using php then you just check the value of the query string.
    PHP Code:
    <input type="radio" name="test" <?php if($_GET['test'] == 1) echo 'checked="checked"'?> />
    ||||If you are getting paid to do a job, don't ask for help on it!||||


  •  

    Posting Permissions

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