how to go from one page to another with php all the data of some checkboxes

0

I have a page with a series of checkboxes, which are generated with php because they are formed depending on the amount of files in a folder.

by clicking on the submit button, I want to be able to show on another page which are the checkboxes pressed.

Do you have any ideas?

    
asked by Sergio Cv 24.11.2016 в 20:12
source

1 answer

0

Well, with something like this:

<form method='post' id='userform' action='thisform.php'> 
   <input type='checkbox' name='checkboxvar[]' value='Option One'>1<br>
   <input type='checkbox' name='checkboxvar[]' value='Option Two'>2<br>
   <input type='checkbox' name='checkboxvar[]' value='Option Three'>3
   <input type='submit' class='buttons'> 
</form>

And in the php:

<?php 

      $miArray = $_POST['checkboxvar']; 
      for($i=0; $i < count($miArray ); $i++){
         echo "Seleccionado " . $miArray [$i] . "<br/>";
      }

?>

I have taken the examples from StackOverflow in English: Stack1 Stack2

    
answered by 24.11.2016 / 20:58
source