Hi
I have a questionnaire which is a mixture of checkboxes and radio buttons. Mainly checkboxes. When selected, each checkbox or radio button also adds a certain score to a running total, using javascript.
Then, the user can press a button to see a report form which will echo back comments relating to what select boxes or radio buttons they chose.
To make each checkbox/radio button pass its status to the report form, it needs a unique identifier. And this has to be name="uniquename". (id="uniquename" doesn't work)
To make the javascript work, each checkbox (and each set of radio buttons) needs a name that is the same. Although the script will pick up on either id or name, id has already been 'used up' - see previous para.
For the select boxes, this is no problem. But if I give the radio buttons different names as unique identifiers, of course this means that people can select more than one radio button. If I give them the same name, so as to work properly as radio buttons, and make the unique identifier as id="uniquename", then the status of the radio button is not passed to the form.
The report form picks up the status of a checkbox called 'appearance' thus:
PHP Code:
<?php if (array_key_exists('appearance',$_POST)) { echo "some text"; } else { echo "some different text"; } ?>
Any ideas how to get out this dilemma? I suppose I could dispense with radio buttons and use some sort of javascript to mimic radio button behaviour within a set of two or three checkboxes. But I'm hoping for something easier, and which will work even if js is disabled.
thanks for any wisdom
tony
|