将基于选择值的动态创建的表单字段传递给php

时间:2019-10-01 14:15:05

标签: javascript php html

该网页根据用户选择创建条目。动态创建的条目必须使用php传递到数据库。我该怎么做?

<div class="section"><span>2</span>Select the number of ingredients required:</div>
    <div class="inner-wrap">
      <input type="number" id="member" min="0" max="20" value="0"  name="num" required><br>
      <button type="button" onclick="addinputFields()">Submit</button>
      <div id="container1"></div>
</div>
function addinputFields(){
    var number = document.getElementById("member").value;
    if (addinputFields.fired)
    {
      alert("To change the value please refresh page");
      return;
    }
    for (i=0;i<number;i++){
        var input = document.createElement("input");
        input.required=true;
        container1.appendChild(input);
        container1.appendChild(document.createElement("br"));
        }
    addinputFields.fired = true;
  }

0 个答案:

没有答案