- $JOINED_N = " checked"; $JOINED_Y = "";
-
- // Check category selection
- $result_user = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_user_cats WHERE userid=%d AND cat_id=%d LIMIT 1",
- array($UID, bigintval($id)), __FILE__, __LINE__);
-
- // When we found an entry don't read it, just change the JOINED_x variables
- if (isset($_POST['cat']))
- {
- if ($_POST['cat'][$id] =='Y') { $JOINED_Y = " checked"; $JOINED_N = ""; }
- }
- else
- {
- if (SQL_NUMROWS($result_user) == 1)
- {
- $JOINED_Y = " checked"; $JOINED_N = "";
+ $content['jn'] = ' checked="checked"';
+ $content['jy'] = '';
+
+ // When we found an entry don't read it, just change the jx elements
+ if (isPostRequestElementSet(('cat'))) {
+ // Form sent?
+ if (postRequestElement('cat', $content['id']) =='Y') {
+ $content['jy'] = ' checked="checked"';
+ $content['jn'] = '';
+ }
+ } else {
+ // Check if he has an entry
+ if (countSumTotalData($UID, 'user_cats', 'id', 'userid', true, sprintf(" AND `cat_id`=%s", bigintval($content['id']))) == 1) {
+ $content['jn'] = '';
+ $content['jy'] = ' checked="checked"';