tiwtiwtiwtiwaaaaa
tiwtiwtiwtiwaaaaa

Reputation: 108

input value from form into array

i have this code :

<?php 
   $no=0;
   foreach($gejala as $g){ 
   $no++;?>
   <tr>

   <td><?php echo $no; ?></td>
   <td><?php echo $g->gejala; ?></td>
   <td><input type="checkbox" name="gejala<?php echo $no;?>" value="<?php echo $no;?>"?></td>

   </tr>

<?php } ?>

i need to get all selected checkbox value from my input into an array so i can use it to get value from my database, using this query

SELECT * FROM gejala WHERE id_gejala IN (array) AND id_penyakit = '1'

Upvotes: 1

Views: 79

Answers (1)

Julien Lachal
Julien Lachal

Reputation: 1141

If you want to get all the values then you should give your checkboxes the same name, this way you'll get them in an array.

Upvotes: 1

Related Questions