} else { if (count($teamdata) > 0 && $teamdata[0]['memberamount'] >= 4) { // this player can not be added to a team, it's full $page->m_smarty->assign("individual", "The national team is already full, it is not possible to add this player to the team"); $page->m_items['token']->setValue("1"); } else { // team does not exists, do u want to create one? $page->addItem("CheckBox", "createteam", "in_template"); $page->m_items['createteam']->setValues(array('1' => "Create team")); $page->m_items['token']->setValue("1"); } } } $page->m_items['token']->addValidation("IsInt"); // show the page $page->showPlatformPage("processForm"); // also show some debug information $page->printDebug(); function processForm() { global $page; // insert player $player_id = $page->addPlayer($_POST, 1); if ($player_id != "") { if ($_POST['addteam']) { // update $team_id = $page->incrementTeam($player_id, $_POST['nationality']); $page->assignTeamMember($player_id, $team_id); } else { if ($_POST['createteam']) { $team_id = $page->createTeam($_POST['nationality']);