Skip to content
Advertisement

How do I pass the values of my checkboxes with PHP to mySQL database?

Now the value in my database is just “Array”. Because, well it is an array. It can see whether I checked at least one thing, or no things at all. If I don’t check any checkboxes it returns nothing, if I check at least one thing it returns “Array”.

I haven’t worked with PHP before, and we didn’t get any classes about this, but after a few days of trying I couldn’t figure it out. enter image description here

JavaScript

Advertisement

Answer

Assuming found is supposed to contain a comma-delimited list of the checkbox values, use implode() to create that from the array.

JavaScript

However, this is generally poor design. See Is storing a delimited list in a database column really that bad?

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement