Get the POST variable, which is an array

All,

I have the following hidden variables:

<input type="hidden" name="chk[10]" value = "cats"> <input type="hidden" name="chk[13]" value = "dogs"> <input type="hidden" name="chk[14]" value = "fish"> 

I want to get these variables through POST and print them. How to do it in PHP?

thanks

+4
source share
2 answers
 foreach($_POST['chk'] as $key => $value) { echo $key, ' => ', $value, '<br />'; } 
+8
source
 $chks = $_POST["chk"]; print_r($chks); 
+2
source

Source: https://habr.com/ru/post/1312103/


All Articles