There are n
checkboxes, with a click on each one there is an entry in the database with the user id
and checkbox id
in a separate table. How to check the conditions for a clicked or not clicked checkbox, so that after reloading the page the checkboxes that were checked remain marked? I tried something like this, I understand that there is an error in the cycle itself, but I donβt know how to fix it, alas:
for ($i = 0; $i < count(ΠΌΠ°ΡΡΠΈΠ² Ρ ΡΠ΅ΠΊΠ±ΠΎΠΊΡΠ°ΠΌΠΈ); $i++){ if (count(ΠΌΠ°ΡΡΠΈΠ² Ρ ΡΠ΅ΠΊΠ±ΠΎΠΊΡΠ°ΠΌΠΈ) >0 ){ $active = ""; if (Π°ΠΉΠ΄ΠΈ ΡΠ΅ΠΊΠ±ΠΎΠΊΡΠ°[$i] != ""){ $active = "active" // ΠΊΠ»Π°ΡΡ Π΄Π»Ρ Π²ΠΊΠ»ΡΡΠ΅Π½Π½ΠΎΠ³ΠΎ ΡΠ΅ΠΊΠ±ΠΎΠΊΡΠ° } } $checkbox .= "<div class="check_ '.$m_active.'"></div>"; }
It is quite clear that if, let's say, there are 3 buttons, and to release the second button, then through such a cycle the 1st and 2nd buttons will be active.