We have created a questionnaire application.
In that we are providing a user to enter one question and multiple answers and submit to store this questionnaire to DB.For adding multiple answers for a single question, we need to dynamically add a row by clicking on add button and delete button for deleting the row on UI.
Now my question is:
- How can I implement the feature of dynamically give a 开发者_JS百科row to enter multiple answers?
- Once multiple answers are added, how I will get multiple answers in the form field to add that in DB?
You can use an array to get all the different values.
E.g.
<input type="text" name="answer[]">
<input type="text" name="answer[]">
<input type="text" name="answer[]">
Regarding adding the extra rows:
- what have you tried so far?
- What do you have troubles with?
- Do you have a specific question?
精彩评论