Hi,

i have a html form for questionnaire whr i have few question.

each one has 2 radio button (yes/no). if value for radio button 'yes' is selected then activate text box to write the comment.

if radio button is selected for 'No' then text box should be disable.

similarly for rest questions (8 question)

now the problem is i m facing how to save the values for each question into table.

This sounds more like a Javascript question as opposed to a PHP question.
Well all you have to do is on the radio button you have to define an "onclick" (or onchange but it doesn't work with IE) event on the two radio buttons like below :-

<form>
  <input type="radio" id="radio1" name="radio2" onclick="document.getElementById('txt1').disabled=true"/>Beta <br />
  <input type="radio" id="radio1" name="radio2" onclick="document.getElementById('txt1').disabled=false"/>Gamma<br />
  <input type="text" name="txt1" id="txt1" /><br />
</form>

Note onclick has been assigned the Javascript code that we wish to execute when someone clicks on the radio button.

hi stephen84s,
thx for your response.

well my problem starts from here only. i have done the text box enable/disable but find problem in php/mysql code part to get the values and insert into db for all of the questions based upon the radio button option.

table structure:
1. Question_ID int (11)
*auto increment
2. Questionnaire_ID varchar(50)
*random generated by using uniquid()
3. Question_Words longtext
*value in text box
4. Answer_Type enum('Text', 'List', 'YesNo')
*What type of response? Yes/No
5. Question_Order int (11)
*Order in list of questions

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.