input type='checkbox' name='$code'>
..is the PHP correctly embedded in this code? See my previous post.
What errors does your Console show?
If you view the source for the page is it correctly formed?
Your code line above does not give the checkbox a value. It is not as useful without a value and, without setting this value (even to "") it may be 'undefined' rather than null or "".
You should be checking the .checked property of a checkbox to see if the user has selected it.
Apologies for that - its been a long day. Ive managed to solve the issue using the .checked function you mentioned. Thanks for your help