echo "This request has been delegated to admin group - {$groups[$cAdmin]}. If you stil want to take an action, select an option below."; } if ($gID == $cAdmin || $gID == 2) { //Acad office always gets to see the form, other groups only when request is meant for them ?> <div class = "post"> <h2 class="title">Take an action</h2> <div class="entry"> <form name="action" method="post" action="acceptReject.php"> <table class="action-table"> <tr> <td><input type="radio" name="reqAction" value="accept"></td> <td>Accept</td> </tr> <?php if (getNextGroup($gID) != -1) { ?> <tr> <td><input type="radio" name="reqAction" value="forward"></td> <td>Forward</td> </tr> <tr> <td></td> <td><select name="forwardID"><?php printNextGroupOptions($gID); ?> </select></td> </tr> <?php } ?>
function printNextGroupOptions($curGroup) { $groupArray = getNextGroup($curGroup); if ($groupArray == -1) { die("No valid group options found.\n"); } $groupKeys = array_keys($groupArray); for ($i = 0; $i < sizeof($groupKeys); $i++) { $index = $groupKeys[$i]; echo "<option value = \"{$index}\">{$groupArray[$index]}</option>\n"; } }