cant understand what is happening in a section of FOREACH loop PHP -


so have used code , know how works because not fan of using stuff don't understand , got code did not show how worked. append checked checkboxes variable $information.

here code used, submitted form , php script

<form name="checkboxform" action="" method="post">  <input type="checkbox" name="ninjas[]" value="stuff">stuff<br>  <input type="checkbox" name="ninjas[]" value="more stuff">more stuff<br> <input type="submit" value="submit" name="submit"> </form> 

so when click submit function runs

//excuse ninja naming part, needed have laugh cause frustrating :) function sneakyninjas() { $array = $_post['ninjas']; $information = ""; foreach ($array $key => $value) {     $information .= $value;  } 

so loops through each value in array , why have named them such.
$keys =>$value part don't understand.

how determine when checkbox has been clicked?
does use boolean sent array?

in understanding process appreciated or link can read on cause have found nothing far, , means correct me wrong said.

when html form submitted, values checkboxes have been checked submitted. unchecked or disabled checkboxes omitted array contains checked values.


Comments

Popular posts from this blog

r - Trouble relying on third party package imports in my package -

Payment information shows nothing in one page checkout page magento -