0

I am showing records in a table from the MySQL database, each record/row has a checkbox, now I have a button to change, but I want to first select the checkbox of any record and send me a popup, in this popup has to registry data show checkbox selected for editing.

From already thank you very much.

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>    
Avinesh Kumar
  • 1,389
  • 2
  • 17
  • 26

1 Answers1

0

You can use isset to check which checkboxes were selected.

<?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
?>

This is just a quick way and I am sure there are lot of other ways tackle this.

Avinesh Kumar
  • 1,389
  • 2
  • 17
  • 26
  • Great, if I send the record to the popup. But do not select the checkbox. I want you to show me the log data checkbox labeled. For example I have a list of 10 records, and if the checkbox active record 6. I want to show only that record chekckbox marked with a popup. – Juan Castro Lurita May 31 '13 at 03:54
  • @JuanCastroLurita I have edited the code above, i hope that is what you were asking for. Can you please explain your requirements in detail. – Avinesh Kumar May 31 '13 at 04:13
  • my button is out of form. I want to send the values ​​to a popup – Juan Castro Lurita May 31 '13 at 04:18
  • use javascript `document.form.submit();` – Avinesh Kumar May 31 '13 at 07:53
  • you have a example, please brother. – Juan Castro Lurita May 31 '13 at 14:30
  • the example in the link [HTML DOM Form submit() Method](http://www.w3schools.com/jsref/met_form_submit.asp), [How to Submit a Form Using JavaScript](http://stackoverflow.com/questions/9855656/how-to-submit-a-form-using-javascript). and there are many more examples if you google. – Avinesh Kumar Jun 02 '13 at 20:40
  • Achieve fix, but I have other problems that are not of this topic. Thanks for your help has helped me a lot. I hope I can help at some time. – Juan Castro Lurita Jun 03 '13 at 15:07