Php 具有相同名称的多个表单数据
我有一个html表单,包含多个同名数据。像这样 HTML代码Php 具有相同名称的多个表单数据,php,html,Php,Html,我有一个html表单,包含多个同名数据。像这样 HTML代码 <tr> <td valign="top"><input id="" type="text" name="asset_id" size="15"/></td> <td valign="top"><input id="" type="text" name="batch_code" size="15"/></td> <td valign=
<tr>
<td valign="top"><input id="" type="text" name="asset_id" size="15"/></td>
<td valign="top"><input id="" type="text" name="batch_code" size="15"/></td>
<td valign="top"><input id="" type="text" name="description" size="50"/></td>
</tr>
<tr>
<td valign="top"><input id="" type="textbox" name="asset_id" size="15"/></td>
<td valign="top"><input id="" type="textbox" name="batch_code" size="15"/></td>
<td valign="top"><input id="" type="textbox" name="description" size="50"/></td>
</tr>
如何在php$\u POST[]中将其发送到后端进程。请帮帮我 将
方括号[]
附加到您的姓名上:
<tr>
<td valign="top"><input id="" type="text" name="asset_id[]" size="15"/></td>
<td valign="top"><input id="" type="text" name="batch_code[]" size="15"/></td>
<td valign="top"><input id="" type="text" name="description[]" size="50"/></td>
</tr>
<tr>
<td valign="top"><input id="" type="textbox" name="asset_id[]" size="15"/></td>
<td valign="top"><input id="" type="textbox" name="batch_code[]" size="15"/></td>
<td valign="top"><input id="" type="textbox" name="description[]" size="50"/></td>
</tr>
在您的php中:
<?php
print_r( $_POST['asset_id'] );
print_r( $_POST['batch_code'] );
print_r( $_POST['description'] );
?>
使用以下HTML:
<tr>
<td valign="top"><input id="" type="text" name="asset_id[]" size="15"/></td>
<td valign="top"><input id="" type="text" name="batch_code[]" size="15"/></td>
<td valign="top"><input id="" type="text" name="description[]" size="50"/></td>
</tr>
<tr>
<td valign="top"><input id="" type="text" name="asset_id[]" size="15"/></td>
<td valign="top"><input id="" type="text" name="batch_code[]" size="15"/></td>
<td valign="top"><input id="" type="text" name="description[]" size="50"/></td>
</tr>
$_POST["asset_id"]; // this is an array of the values of the asset_id textboxes
$_POST["batch_code"]; // array of batch codes
$_POST["description"]; // array of descriptions