if (Request::hasVar('submit', 'POST')) {
    $mode = $_POST['mode'];

    if ('delete' === $mode) {
        foreach ($topic_id as $tid) {