将html表中的多行插入数据库

xqnpmsa8  于 2021-06-25  发布在  Mysql
关注(0)|答案(0)|浏览(235)

我想我的问题是在隐藏字段中检索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>"; }

提前谢谢!

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题