According to your code, you start with an empty variable, then you set it to 0 then you increment it. Finally, you make the hidden field's name the incremented variable. After your POST, you're trying to print out the value of an empty variable again. This is what your posted code indicates. You say your code is simplified, so I'll assume I don't have the big picture here.
Anyways, despite the limited information you've shared, I will guess that all you need to do is try substituting a line:
echo"<input name=inactives type=checkbox value=$inactives>";
// and ...
echo"<br>{$_POST['inactives']}";
If this is way off, please be more specific.