php - 启用复选框并按编辑按钮并在弹出窗口中打开

标签 php mysql

我正在显示来自 MySQL 数据库的表中的记录,每个记录/行都有一个复选框,现在我有一个可以更改的按钮,但我想首先选择任何记录的复选框并向我发送一个弹出窗口,在此弹出窗口必须选择注册表数据显示复选框进行编辑。

已经非常感谢您了。

while ($rsEmp = mysql_fetch_assoc($queEmp)) { .....



echo "<tr>
<td bgcolor='#E6E6E6' class=item_listado_registros align=center><input name=casilla[] type=checkbox id=checkbox[] value=$rsEmp[id]></td>
<td id=linkreg href=# id=linkregistro onclick=Abrir_ventana('popup_ver_compra.php?id=$rsEmp[id]') align=center bgcolor='#E6E6E6' class=item_listado_registros align=center>".$rsEmp['codigo']."</a></td>
<td id=linkreg href=# id=linkregistro onclick=Abrir_ventana('popup_ver_compra.php?id=$rsEmp[id]') align=center bgcolor='#E6E6E6' class=item_listado_registros align=center>".$rsEmp['cantidad']."</td>
echo "<tr>

<button class="boton_data"  onclick="Valida_mod(); Abrir_ventana('new_popup.php?id=$rsEmp[id]')" id="btn_agregar">Modificar</button>    

最佳答案

您可以使用 isset 检查选中了哪些复选框。

<?php
if(isset($_POST['submitbutton'])){//check if submit button clicked
  if(isset($_POST['checkboxes'])){ // check if checkbox checked
      //get checkbox details and display
      $checked = $_POST['checkboxes'];
      for($i=0;$i<count($checked);$i++){
          echo $checked[$i]."<br/>";
      }
  }else{
      //display error message
  }

}

echo '<form name="" action="'.$_SERVER["PHP_SELF"].'" method="POST">

</form>';
   //table with checkbox
   //button
?>

这只是一种快速方法,我相信还有很多其他方法可以解决这个问题。

关于php - 启用复选框并按编辑按钮并在弹出窗口中打开,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16848820/

相关文章:

PHP/MySQL更新查询问题

mysql - 如何处理mysql表中的大量行

javascript - 将 html <select> 选项设置为基于当前时间的默认值

php - 处理现实世界中的交易

php - mysql 在开始和/或结束时不断删除零

php - mysqli 结果数量取决于 while 内的获取

php - 如果 PayPal 包含参数,则忽略返回 url

javascript - 仅针对新用户弹出模式 - bootstrap , php , js

mysql - 当你不知道它会是什么时,在 MySQL 中存储一些数据字段

大型 mysqldump 段错误 --where=(id IN ...)