问题描述
我创建了一个Web应用程序,可以使用复选框删除产品表中的项目。
我需要显示< TR>中的每个产品和产品有相应的复选框删除它,使用可以选中复选框,然后他将按表格中的更新按钮提交处理。
[PHP]
//这里我将从MySQL表中获取值
//此区域位于带有更新按钮的HTML表单内,并且在提交时它将通过//到PHP页面进行处理。
while($ row = mysql_fetch_assoc($ result))
{
echo''< ; tr>
< td>''。$ row [''p_name'']。''< / td>< td>
<输入类型= QUOT;复选框"名称= QUOT; PID"值= QUOT;。$行[ P_ID]"。; />< td>
< / tr>'';
}
[/ PHP]
但问题出在我的编码中,因为复选框名称我将名称命名为 pid。
因为我把它放在了循环中5个产品将有5个复选框。
然后名称将创建重复。
那么我无法从这里获得此值PHP端。只有一个复选框值将进入PHP页面。
那么当用户提交表单时,如何发送所有选中的复选框值。
Hi, I have created a web application that enables to Delete Items in a product table using check boxes.
I Need to Display each and every product in <TR> and with the product there is a corresponding check box to delete it, use can select the check box and then he will press the Update Button in the Form to submit for processing.
[PHP]
//Here I will get the Values from MySQL Table
//This Area is Inside a HTML form with Update button and On Submit it will pass //to PHP page for precessing.
while($row = mysql_fetch_assoc($result))
{
echo ''<tr>
<td>''.$row[''p_name''].''</td><td>
<input type="checkbox" name="pid" value="''.$row[''p_id''].''" /><td>
</tr>'';
}
[/PHP]
But the problem is here in my coding as the checkbox name I am giving the name as pid.
Since i have put it inside while loop for 5 products there will be 5 check boxes.
Then name will create duplicates.
So then I cant get this Value from PHP side. Only one of the check box value will come to PHP page.
So How do i send all the selected check box values when user Submit the Form.
这篇关于将动态表单值发送到PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!