foreach ($grouptags as $id => $tag) { if (!$tag || $tag == strtolower($_REQUEST['grouptag'])) { unset($grouptags[$id]); } } //end foreach grouptags } //end if delete if (isset($_REQUEST['add'])) { $grouptags[] = strtolower($_REQUEST['grouptag']); } //end if add $grouptags = implode(' ', array_unique($grouptags)); $group->my->set('grouptags', $grouptags); $group->save(); header('Content-Type: text/plain'); if (isset($_REQUEST['form'])) { echo '<b>Group Tags:</b> '; foreach (explode(' ', $grouptags) as $id => $grouptag) { $grouptag = str_replace('+', ' ', $grouptag); if ($id > 0) { echo ', '; } echo $grouptag . ' '; XNC_Ajax::Link('<img src="http://www.ning.com/xnstatic/icn/cross.gif" alt="[X]" />')->actionUrl('/groupEdit.php?form&delete&grouptag=' . urlencode($grouptag) . '&id=' . $_REQUEST['id'])->htmlElement('group-tags')->callback('Loading', '$("group-tags").innerHTML = "<i>Deleting...</i>";')->confirm('Delete the ' . $grouptag . ' tag?')->make(); } //end foreach grouptags exit; } //end if isset form header('Location: ' . $_REQUEST['return_to'], TRUE, 303);