php - 将 HTML 表中的多行插入数据库
问题描述
我认为我的问题是在隐藏字段中检索 id
while( $row = mysqli_fetch_assoc($result)){
echo "<tr><td><form action='workshopreq.php' method='POST'> <td=width='5%'><input type='checkbox' name='foo' value='bar1'/> </td>"."<td>". $row["wID"]. "</td><td>" . $row["wName"]. "</td><td width='10%'>" . $row["services" ]. "</td><td>" . $row["other"]. "</td><td width='5%'>" . $row["area"]."</td>";
echo "<td><input type='hidden' name='status' value='".$row["wID"]."'><input type='submit' name='conf' value='confirm'></td><td><input type='submit' name='decline' value='decline'></td></form></tr>";
}
if(isset($_POST['conf'])){
$sql1= "INSERT INTO acceptedWS(wName, wEmail, wPass, services, other, Workshop, area, starthr, endhr,clock1,clock2)
SELECT wName, wEmail, wPass, services, other, Workshop, area, starthr, endhr,clock1,clock2 FROM Workshop where Workshop.wID='".$row["wID"]."'";
$res= mysqli_query($conn,$sql1);
}
if(isset($_POST['decline'])){
//delete from database
}
echo "</table>"; }
提前致谢!
解决方案
推荐阅读
- ansible - 如果第一次失败,Ansible 使用不同的主机名
- ubuntu-16.04 - sudo apt update && sudo apt dist-upgrade 7 未升级
- python - 无法使用 __init__.py 创建模块
- java - 最近 Xodus 版本中的服务提供者接口
- java - JdbcTemplate 插入成功但数据库中没有行
- database - 清除推荐的 wso2 表后,我在发布者-> 分析菜单中丢失了我的分析和统计信息
- python - Pyqt连接到按钮另一个文件中的函数绘制图形
- css - 如何在材质 ui Dialog 组件上添加背景图像
- python - 如何根据日期标准查找熊猫列中前 n 行的平均值?
- .net - 带有 Visual Studio 代码的 F# .net 框架