При нажатии на кнопку add more в базу данных сохраняются только первые данные [закрыто]

 <input type="text" name="quantity" id="quantity" placeholder="QUANTITY">
 <!-- <label for="phone">phone</label><br> -->
 <!-- <input type="text" name="phone" id="quantity-type" style="width:180px;"> -->

 <select name="quantity_type" id="quantityType">
     <option value="kg">Kg</option>
     <option value="ton">Ton</option>
     <option value="peices">No's</option>
 </select>
 </div>
 <div>
     <select name="brand_name" id="brand_name" class="brand_name" onChange="check(this);">
         <option value="Shyam Steel Industries Ltd.">Shyam Steel Industries Ltd.</option>
         <option value="JSW ( Jindal South West ) Steel Ltd.">JSW ( Jindal South West ) Steel Ltd.</option>
         <option value="Tata Steel Ltd.">Tata Steel Ltd.</option>
         <option value="Steel Authority of India (SAIL)">Steel Authority of India (SAIL)</option>
         <option value="Essar Steel Ltd.">Essar Steel Ltd.</option>
         <option value="Jindal Steel and Power Ltd.">Jindal Steel and Power Ltd.</option>
         <option value="VISA Steel">VISA Steel</option>
         <option value="SRMB Steel">SRMB Steel</option>
         <option value="Electro Steel">Electro Steel</option>
         <option value="MESCO Steel">MESCO Steel</option>
         <option value="Kamdhenu Steel">Kamdhenu Steel</option>
         <option value="Rathi">Rathi</option>
         <option>others</option>
     </select>
     <input id="other-div" name="brand_name" style="display:none;" placeholder="Enter Brand Name*">
     <button class="addNewProd" id="addNewProd" type="button">+Add more</button>
     <div id="newProduct"></div>
 </div>
 </div>
 </div>

введите описание изображения здесь

function addHtml(event) {

    console.log(event.target)
    let parentDiv = event.target.parentElement;
    console.log(parentDiv)
    count += 1;
    console.log(count)
    let html = `<div id="prodcount-${count}"> <select name="materials" id="prodVariety">{% for m in material_data %}<option value="{{m.variety_name}}">{{m.variety_name}}</option>{% endfor %}</select><br><input type="text" name="phone" id="quantity"  placeholder="QUANTITY"><select name="quantity_type" id="quantityType" ><option value="ton">Ton</option><option value="cft">CFT</option><option value="kg">KG</option></select><br><select name="brand_name" id="brand_name" onChange="check2(this);"> <option value="Shyam Steel Industries Ltd.">Shyam Steel Industries Ltd.</option> <option value="JSW ( Jindal South West ) Steel Ltd.">JSW ( Jindal South West ) Steel Ltd.</option> <option value="Tata Steel Ltd.">Tata Steel Ltd.</option> <option value="Steel Authority of India (SAIL)">Steel Authority of India (SAIL)</option> <option value="Essar Steel Ltd.">Essar Steel Ltd.</option> <option value="Jindal Steel and Power Ltd.">Jindal Steel and Power Ltd.</option> <option value="VISA Steel">VISA Steel</option> <option value="SRMB Steel">SRMB Steel</option> <option value="Electro Steel">Electro Steel</option> <option value="MESCO Steel">MESCO Steel</option> <option value="Kamdhenu Steel">Kamdhenu Steel</option> <option value="Rathi">Rathi</option> <option>others</option> </select><br> <input id="other-div" onchange="changeID()" style="display:none;" placeholder="Enter Brand Name*"></div>`;
    parentDiv.querySelector("#newProduct").insertAdjacentHTML('beforeend', html);
    //document.getElementById("emailId").innerHTML = '<input type="text" value="test_input"/>';
}
Вернуться на верх