Hello all,
I think the title correctly represents what it is that I wish to do.
I am creating a footy tips site, which allows users to place tips on who they think will win in each of the 8 weekly games.
On the tipping page, the games are inserted via an array, and the int's are changed to represent names:
//Connect to the db
$conn = pg_pconnect("dbname=footytips user= password=");
if (!$conn) {
echo "An error occured.\n";
exit;
}
//setup & run the query to the database
$query1 = pg_query($conn, "SELECT * FROM game WHERE round = $data");
//setup ref to query1
while($row1 = pg_fetch_array($query1)) {
$game = $row1['game'];
$date = $row1['date'];
$time = $row1['time'];
$ground_id = $row1['ground_id'];
$team1_id = $row1['team1_id'];
$team2_id = $row1['team2_id'];
$result1 = pg_query($conn, "SELECT name FROM team WHERE $team1_id = id");
while($row2 = pg_fetch_array($result1)) {
$team1_id = $row2['name'];
$result1 = pg_query($conn, "SELECT name FROM team WHERE $team2_id = id");
while($row3 = pg_fetch_array($result1)) {
$team2_id = $row3['name'];
$result1 = pg_query($conn, "SELECT name FROM ground WHERE $ground_id = id");
while($row4 = pg_fetch_array($result1)) {
$ground_id = $row4['name'];
It then gets put dynamically into a table row (each record) and the while arrays are closed:
print "\t<tr>\n";
print "<td>".$row1['game']."</td> \n";
print "<td>".$row1['date']."</td> \n";
print "<td>".$row1['time']."</td> \n";
print "<td>".$row4['name']."</td> \n";
print "<td>".$row2['name']."</td> \n";
echo ('<td><input type="radio" name="winner[id]"'.'value="home"/></td>');
print "<td>".$row3['name']."</td> \n";
echo ('<td><input type="radio" name="winner[id]"'.'value="away"/></td>');
print "\t</tr>\n";
}
}
}
}
?>
As you can see I am using radio buttons to allow users to choose there winner, but atm the radio buttons are all grouped together and so for the different games, only 1 radio button can be selected.
What I want is for each game, the user select 1 radio button, which represents the team they are pciking for a winner. I have attached a image of test data, and how the table looks to try and help explain this further.
Can anyone out there, point me in the right direction, or lead me to a tutorial.
thank you very much,
Matt