Jump to content

Radio Button With With Only Initial Default Value


gsingh2011

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...