Retrieve team from database then display TeamVsOpponent

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
NewbieET
Forum Newbie
Posts: 6
Joined: Thu May 02, 2013 8:04 am

Retrieve team from database then display TeamVsOpponent

Post by NewbieET »

Hey guys,

Im working on a sports club website.
I have in place already fixtures and teams for a particular club.

Now id like to be able to select players to play in each fixture. I have created a teamselection.php page which I have created a dynamic drop down box to list all the fixtures that are linked to the club which the user is logged into.

From here, once the user has selected the fixture, I want to create a list of the players currently selected as playing in that game.
For this I have created a new table called team_selection which will be used to store the players that are playing in each fixture.

Here is my code so far:

Code: Select all

<table width="60%" align="center" cellpadding="0" cellspacing="0" border="0" class="game">
<tr>
<th colspan="2">
Team Selection
</th>
</tr>
<tr>
<td width="63%">
<b>
Select Fixture You Wish To View Team Selection For:
</b>
</td>
<td align="center">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<select name="fixturedrp"><option value='' selected disabled>Select Fixture</option>
<?php 
	$sql = "SELECT * FROM fixtures WHERE club_id = '$id'";
  	$result = mysql_query($sql);
	while($row = mysql_fetch_array($result)){
		$fixture_id = $row["fixture_id"];
		$team = $row["team"];
		$opponents = $row["opponents"];
		$fixture = "$team Vs $opponents";
	?>
	<option value="<?php echo $fixture_id ?>"><?php echo $fixture ?></option>
	<?php } ?>
</select>
</td>
</tr>
<tr>
<td width="63%">
</td>
<td align="center">
<input name="submit" type="submit" value="Select Fixture" />
</form
</td>
</tr>
</table>
How would I go about the adding players to the fixture?

Cheers
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Retrieve team from database then display TeamVsOpponent

Post by requinix »

Depends how you want people to do that. Have them look at a fixture and add players? Look at a player and add them to a fixture? Dedicated page where you search for a player and fixture and add the relationship?
Post Reply