Avoid possible SQL injection vulnerability - thanks to @jordanlev
Code tidy
Avoid PHP error if no checkbox selected -- thanks to @jordanlev
Added entity encoding, long PHP tags and some cleanup -- thanks @jordanlev
Updated readme