| | |
get the value of radio button and save into database
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Dec 2008
Posts: 6
Reputation:
Solved Threads: 0
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.
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 :-
Note
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 :-
html Syntax (Toggle Plain Text)
<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. Last edited by stephen84s; Dec 5th, 2008 at 11:26 am.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."
"How to ask questions the smart way ?"
"How to ask questions the smart way ?"
•
•
Join Date: Dec 2008
Posts: 6
Reputation:
Solved Threads: 0
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
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
![]() |
Similar Threads
- Cannot right click on desktop (Viruses, Spyware and other Nasties)
- please help (Viruses, Spyware and other Nasties)
- I get a "virus Alert" in toolbox (Viruses, Spyware and other Nasties)
- Desperately Seeking Something (Viruses, Spyware and other Nasties)
- Freeprodtb!! (Viruses, Spyware and other Nasties)
- Macromedia Flash Player stopped an unsafe operation (Viruses, Spyware and other Nasties)
- Many problems... (Viruses, Spyware and other Nasties)
- Oh man I fell for an AIM virus I am a total idiot (Viruses, Spyware and other Nasties)
- Array String not working? (JSP)
- retrieving ids from dynamically created controls in asp.net (ASP)
Other Threads in the PHP Forum
- Previous Thread: code will not subtract negative number in mysql field? :( pls help!
- Next Thread: if statement help
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code cron curl database date directory display download dynamic echo email encode error fcc file files folder form forms function functions google howtowriteathesis href htaccess html image images include insert integration ip java javascript joomla ldap limit link login loop mail menu mlm mod_rewrite multiple multipletables mysql oop open parse paypal pdf php problem provider query radio random recursion regex remote script search server sessions sms soap source space sql strip_tags structure syntax system table template tutorial update upload url validation validator variable video web xml youtube






