dongluan0020 2015-03-07 09:11
浏览 35

将选中的项插入另一个sql表? (PHP和SQL)

Hi everyone I'm new here ! I'm wondering how I can insert the values of a printed row when it's specific checkbox is ticked.

here is my code:

<?php
$query = "SELECT * FROM phpmyreservation_forvalidation";
$result = mysql_query($query);
?>

<form action='insertrecords.php' method='post'>
<?php
echo "<table  cellpadding='0' cellspacing='0' border='1'>";
echo "<tr> <th>reservation_id</th> <th>reservation_user_name</th> <th>reservation_day</th> <th>reservation_week</th> 
    <th> # </th></tr>";
while($row = mysql_fetch_array( $result )) {
echo "<tr><td>"; 
echo $row['reservation_id'];   
echo "</td><td>"; 

echo $row['reservation_user_name'];
echo "</td><td>"; 

echo $row['reservation_day'];
echo "</td><td>"; 

echo $row['reservation_week'];
echo "</td><td align='center'>"; 

echo "</td>";  
?>

<td><input name="checkbox[]" type="checkbox" id="checkbox[]"  value="<?= $row['id'] ?>" ></td>

<?php
} 
echo "</table>";
?>


<input type='submit' value='Submit' />
</form> 

I'm not sure if what i've done is correct, I also don't have an insert records.php yet, I tried to make one but it didn't work and now I'm really confused. Does anyone know how I can do this ? Thank you !

additional notes: What I'm doing is a validation system the schedules that are not yet validated are on a separate table, when the admin validates them it gets inserted into the phpmyreservation_reservations table.

Thanks !

  • 写回答

3条回答 默认 最新

  • doumi1852 2015-03-07 09:25
    关注

    fetch the 'phpmyreservation_forvalidation' result into variables and insert it into your 'phpmyreservation_reservations' table when the form is submit.

    评论

报告相同问题?

悬赏问题

  • ¥20 关于多单片机模块化的一些问题
  • ¥30 seata使用出现报错,其他服务找不到seata
  • ¥35 引用csv数据文件(4列1800行),通过高斯-赛德尔法拟合曲线,在选取(每五十点取1点)数据,求该数据点的曲率中心。
  • ¥20 程序只发送0X01,串口助手显示不正确,配置看了没有问题115200-8-1-no,如何解决?
  • ¥15 Google speech command 数据集获取
  • ¥15 vue3+element-plus页面崩溃
  • ¥15 像这种代码要怎么跑起来?
  • ¥15 安卓C读取/dev/fastpipe屏幕像素数据
  • ¥15 pyqt5tools安装失败
  • ¥15 mmdetection