开发者

Dynamic rows and inputs

开发者 https://www.devze.com 2023-04-13 03:20 出处:网络
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.

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:

  1. How can I implement the feature of dynamically give a 开发者_JS百科row to enter multiple answers?
  2. 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?
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号