my $tournament = $cgi->param('tournament');
my $nick = $cgi->param('nick');
+my $country = $cgi->param('country');
+my $club = $cgi->param('club');
-$dbh->do('INSERT INTO players (nick) VALUES (?)', undef, $nick);
+$club = undef if ($club == -1);
+
+$dbh->do('INSERT INTO players (nick, country, club) VALUES (?, ?, ?)', undef, $nick, $country, $club);
my $ref = $dbh->selectrow_hashref('SELECT player FROM players WHERE nick=?',
undef, $nick);
my $tournament = $dbh->selectrow_hashref('SELECT * FROM tournaments NATURAL JOIN seasons NATURAL JOIN countries NATURAL JOIN machines NATURAL JOIN scoringsystems WHERE tournament=?', undef, $id);
my $registered = ccbs::db_fetch_all($dbh, 'SELECT * FROM tournamentparticipation NATURAL JOIN players WHERE tournament=? ORDER BY LOWER(nick)', $id);
my $available = ccbs::db_fetch_all($dbh, 'SELECT * FROM players WHERE player NOT IN ( SELECT player FROM tournamentparticipation WHERE tournament=? ) ORDER BY LOWER(nick)', $id);
+my $countries = ccbs::db_fetch_all($dbh, 'SELECT * FROM countries ORDER BY countrycode');
+my $clubs = ccbs::db_fetch_all($dbh, 'SELECT * FROM clubs ORDER BY clubcode');
ccbs::print_header();
ccbs::process_template('registration.tmpl', $tournament->{'tournamentname'}, {
tournament => $tournament,
registered => $registered,
available => $available,
- selected_player => $selected_player
+ selected_player => $selected_player,
+ countries => $countries,
+ clubs => $clubs
});
$dbh->disconnect;
<th>Nick</th>
<td><input name="nick" /></td>
</tr>
+ <tr>
+ <th>Land</th>
+ <td>
+ <select name="country">
+[% FOR c = countries %]
+[% IF c.countrycode == "NOR" %]
+ <option value="[% c.country %]" selected="selected">[% c.countrycode %] - [% c.countryname %]</option>
+[% ELSE %]
+ <option value="[% c.country %]">[% c.countrycode %] - [% c.countryname %]</option>
+[% END %]
+[% END %]
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <th>Klubb</th>
+ <td>
+ <select name="club">
+ <option value="-1" selected="selected"></option>
+[% FOR c = clubs %]
+ <option value="[% c.club %]">[% c.clubcode %] - [% c.clubname %]</option>
+[% END %]
+ </select>
+ </td>
+ </tr>
<tr>
<th colspan="2">
<input type="hidden" name="tournament" value="[% tournament.tournament %]" />