如何将HTML表数据发送到php代码



我有一些输入字段和一个html表格的形式,我想发送所有的数据,包括所有行从表到php函数在一个编码器控制器。我的表数据是使用javascript动态填充的。

<form method="POST" >
<input type="text" class="form-control" id="pname" placeholder="Enter Patient name here" name="pname"  >
<input type="number" class="form-control" id="p-age" name="p-age"  >

<input type="radio" id="male" name="sex" value="male"  >
<label for="male" class="receipt-label mr-2">Male</label>
<input type="radio" id="female" name="sex" value="female"  >
<label for="female" class="receipt-label mr-2">Female</label>

<table class="table" id="dest_table" >
<thead class="thead-dark">
<tr>
<th scope="col">Test ID</th>
<th scope="col">Test Name</th>
<th scope="col">Price</th>
<th scope="col" style="text-align:center;">Action</th>
</tr>
</thead>
<tbody>
</tbody>
</table>

<button type="submit" name="submit" class="btn btn-info btn-lg" id = "submit">Print</button>                    
</form>               

只需在表中添加一些隐藏字段

<form method="POST" >

<input type="text" class="form-control" id="pname" placeholder="Enter Patient name here" name="pname"  >

<input type="number" class="form-control" id="p-age" name="p-age"  >

<input type="radio" id="male" name="sex" value="male"  >
<label for="male" class="receipt-label mr-2">Male</label>

<input type="radio" id="female" name="sex" value="female"  >
<label for="female" class="receipt-label mr-2">Female</label>


<table class="table" id="dest_table" >
<input type="hidden" name="hid-box" value="1" /> 
<thead class="thead-dark">
<tr>
<th scope="col">Test ID</th>
<th scope="col">Test Name</th>
<th scope="col">Price</th>
<th scope="col" style="text-align:center;">Action</th>
</tr>
</thead>
<tbody>
</tbody>
</table>



<button type="submit" name="submit" class="btn btn-info btn-lg" id = "submit">Print</button>                    

</form> 

相关内容

  • 没有找到相关文章

最新更新