php - Retrieve POST checkbox data from form if they exist -


Hello people I'm having trouble recovering checkbox data from people form I have a site in which the user added the checkbox So, I'm writing them like this:

  & lt; Table style = "padding: 10px;" & Gt; & Lt ;? Php $ query_boolean = $ DB- & gt; Prepare ("selection" * moduls type = 'boolean' '') or die (mysql_error ()); $ Query_boolean-> executed (); while (($ row = $ query_boolean-> fetch) )! = False? {? & Gt; & lt; tr & gt; & lt; td & gt; & lt ;? php echo $ row- & gt; name? & Gt;: & lt; / td & gt; & Lt; td & gt; & lt ;? php $ s = "" $ S = sprintf ('& lt; input type = "checkbox" category = "textbox" name = "boolean_% s" value = "yes" $ S = sprintf ('& lt; input type = "checkbox" category = "textbox" name = "boolean_% s" value = "no" & Gt;% s', $ row-> ID, no;) resonant $ s;? & Gt; & lt; / t Nd   

I now have an advanced search in which I To check through each checkbox to see if that is selected (ether, yes, no, or both). How can I get the information from each checkbox in the variable? Thanks a lot!

The checkbox must be attributed to receiving post data

check = "check"

Edit: If you have 2 checkboxes in this way ..

  & lt; Input type = "checkbox" checked = "check" class = "textbox" name = "boolean_ge" value = "yes" & gt; & Lt; Input type = "checkbox" class = "textbox" name = "boolean_no" value = "no" & gt;   

When you submit your form, the checkbox with the check box will be sent as POST and the unsecured attributes will be sent.

 < Code> if (continue ($ _ POST ['search'])) {$ all_checked = array (); Foreign currency ($ _ POST $ key = & gt; $ value) {if (strokes ($ key, "boolean_")> 1) {$ all_checked [$ key] = $ value; }} Var_dump ($ all_checked); }   

In this way you will get all the marked boxes within the $ all_checked array. All other checks have not been marked!

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -