Welcome to PHPBuilder!
I see a few issues that will keep us from helping here. The first one won't: try using the board's PHP tags for quoting your code. It keeps the page somewhat less cluttered and also has syntax highlighting that can help an experienced person spot potential problems without having to think too hard ;-)
This one might be an issue: you didn't show us your connection logic, etc. One thing that would keep it from working is a failure in those steps. One common error for new programmers is that they don't check to see if their connection, or their query, was successful, but just assume that it was, and then end up scratching their heads over the lack of results from their program.
I do see one bug here, for sure: You're using assignments instead of comparisons here:
if ($results[element_37_4] = 4) {
You want to use "==" to do a comparison ... in your function, each one of those will be true; I assume then the first one will return and the rest will never even be used.
Finally, we can't really help if you don't say what the problem is 😉
We'd like to know the desired result from your code, AND the way that your result is different from that ... do you have a blank screen? An error message? All boxes there but not checked? All boxes checked?
Hopefully this will get you going in the right direction.
Again, bienvenidos a PHPBuilder 🙂