gsingh2011 Posted February 6, 2010 Share Posted February 6, 2010 I have a site with a few radio buttons and a submit button. By default, the first button is selected. Whenever I press submit, the first button is selected again. However, I want whatever the last selected button was to stay selected. The form is submitted to a php script in the same file. How do I set an initial default value but have the last radio button selected remain checked? Link to comment Share on other sites More sharing options...
jeffman Posted February 6, 2010 Share Posted February 6, 2010 Since it is in the same document, and PHP is capturing the value of the selected button, PHP can also set the checked value of the correct button. Something like:<input type="radio" name="something" value="1" <?php if ($x) echo 'checked="checked"' ?> > Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.