Can I use PHP checkbox array with the GET Method?
And if there are two checkboxes clicked, will that result in: some.php?param=1¶m=2 ?
As you know, I am not used to write into database, I’m just getting the parameters. Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You need to pass the checkboxes with the same field name followed by
[]so PHP recognizes the array.Like so:
So the GET would be:
if every checkbox is clicked. (POST similar)
Please note, that only the clicked checkboxes will be submitted. So, if just
bar1andbar2are clicked, then the GET would beThen you can access that array via
or similar to POST
Hope that helps 🙂