<div class="large-6 columns"> <?php echo "<h4>" . __('Tournament List', 'oscimp_trdom') . "</h4>"; ?> <table id="tournament_table" class="tournament_table" summary="Tournament Table"> <thead> <tr> <th>No</th> <th>Tournament</th> <th>Season</th> <th>Format</th> <th>Action</th> </tr> </thead> <?php $tr = getTournament(); foreach ($tr as $row) { ?> <tr id="<?php echo $row->id; ?> tournament"> <td><?php echo $row->id; ?> </td> <td><?php echo $row->tournament; ?> </td> <td><?php
function createSelect($table, $column, $selected = null) { $html = "<select id='{$table}' name='{$column}'>"; $data = null; if ($table == "Team") { $data = getTeamsDT(); } else { if ($table == "Tournament") { $data = getTournament(); } } $html .= "<option value=''>Select {$table}</option>"; foreach ($data as $row) { if ($table == "Team") { if ($row->id === $selected) { $html .= "<option id='{$row->id}' value='{$row->id}' selected>{$row->team}</option>"; } else { $html .= "<option id='{$row->id}' value='{$row->id}'>{$row->team}</option>"; } } else { if ($table == "Tournament") { if ($row->id === $selected) { $html .= "<option id='{$row->id}' value='{$row->id}' selected>{$row->tournament}-{$row->season}</option>"; } else { $html .= "<option id='{$row->id}' value='{$row->id}'>{$row->tournament}-{$row->season}</option>"; } } } } $html .= "</select>"; return $html; }