Sorry if this is in the wrong section.
I am designing a survey spread out over multiple pages and have alot of yes/no questions using radio buttons.
I want to be able to offer users to go back and change questions and at the same time keep there answer checked.
I did get it to work with alot of "if statements" but the code is messy and I have to apply it to every question. Is there a way to check a radio button based on a variable?
Saving value of check box
Moderator: General Moderators
Re: Saving value of check box
yes... try naming all the checkboxes with the same name and by the time you CATCH the values using PHP code that is automatically an ARRAY.
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
Re: Saving value of check box
However, when you rename all the checkbox elements, also add an opening and closing set of square brackets after its name e.g.:
The square brackets tells PHP that this element is being passed as an array.
Code: Select all
<input type="checkbox" name="check1[]" />