View Full Version : GET value into radio button

07-27-2007, 11:46 PM
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:


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

07-28-2007, 12:37 AM
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.

<input type="radio" name="test" <?php if($_GET['test'] == 1) echo 'checked="checked"'; ?> />