I have a database with tables of states and counties. The first page produces a dynamically created list of check boxes. The visitor checks which counties they select and I want to display those choices (and insert them into another table). I am getting a blank page. I am not getting any error messages.
You need to name the checkboxes county - This will mean the browser submits the checkboxes as an array which you can then loop through as demonstrated in your php code.
No! You don’t even need an integer inside the symbols.
All you need is - as you see it. Two square brackets with NOTHING inside. Thats all you need and then you can dynamically output them and process them. You don’t need to provide any form of indexing for them at all.
It serves no purpose really because if you’re generating the checkboxes dynamically then unless you’re keeping a list/array of the checkboxes that were output in the session then there is not much point outputting them with an index unless you’re checking that index against something on the server.
If you’re not keeping any records of what checkboxes you’ve issued anywhere then all you’re doing is actually bogging down phps code execution and parsing time because its having to parse your checkbox output string and replace $i with a number which in reality you don’t need anyway once the form is submitted.
When the form is submitted you can just use foreach() to loop through the array automagically as you have been doing anyway and thus the need for any form of index in is not needed.
You can still do it if you want to, you’re not actually doing anything wrong BUT why do it unless you’re processing it?