I forgot to say there are drop down menus also that I would like to keep the chosen value of
I have a form with checkboxes, a radio buttons, and a few text fields. I know how to keep the text field values after form submit, but I would like to keep the radio button selection and checkboxes checked after submit. I am posting to the same page.
To have the radio buttons and checkboxes pre-checked, you need to add the
checked="checked"attribute to the HTML you generate for each control you want to display checked.For example, if you currently have this:
You want to change it to this:
Update: For drop down menus, you want to change this:
To this, which uses
selected="selected":Be careful to keep the two “bar” values that appear above synchronized (echoing the options in a loop will help to make sure of that).