welcome I have two tables in the database:- The first: for the same task The second: for the task parts
How to submit the form that contains the task, and a list of the parts of the task:
$('#btn_create_Mission').click(function () {
var t = $("#Table_Missions tbody")
var l = '<tr>';
l += '<td hidden=hidden">';
l += '<input name= "ID_Mission_Detalis" id="td_ID_Mission_Detalis" type="text" value="0" />';
l += '</td>';
l += '<td>';
l += '<input name= "Text_Mission" id="td_Text_Mission" type="text" />';
l += '</td>';
l += '<td>';
l += '<input name= "Value_Mission" id="td_Value_Mission" type="text" />';
l += '</td>';
l += '<td>';
l += '<button id="btn_delete_mission" type="button">DELETE PART MISSION</button>';
l += '</tr>';
t.append(l);
}
)
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<form action="/Programe/Save_Mission" method="post"> <table>
<tr>
<td>
ID Mission :
</td>
<td>
<input id="Name_Mission" name="Name_Mission" type="text" value="0" />
</td>
</tr>
<tr>
<td>
Name Mission :
</td>
<td>
<input id="Name_Mission" name="Name_Mission" type="text" value="0" />
</td>
</tr>
</table>
<br />
<button type="button" id="btn_create_Mission" class="btn btn-success">CREATE PART MISSION</button>
<br />
<table id="Table_Missions">
<thead>
<tr>
<th>NAME PART MISSION</th>
<th>VALUE PART MISSION</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<input type="submit" value="SAVE ALL" />
</form>
I want when I press the Save All button it sends the form and it also contains a list of the parts Mission
I hope the code and the problem is clear, as I want to send (the task) with (the parts of the task)
Please check the updated code as your requirement
Few things are highlights:
HTML
Javascript