I am currently in the process of creating a baseball-themed website backed by a database. I have a Scores page that displays a league scoreboard for a chosen date by the user: Screenshot of Scores page
I am using retrosheet game logs stored in a sqlite database to make this happen with the following code:
$sql = "SELECT *, v.teamName AS 'Visitor', h.teamName AS 'Home' "
. "FROM Games2 "
. "INNER JOIN TeamNames AS v "
. "ON Games2.vTeam = v.teamID "
. "INNER JOIN TeamNames AS h "
. "ON Games2.homeTeam = h.teamID "
. "WHERE date = $date";
$result = $conn->query($sql);
while ($row = $result->fetch(SQLITE3_ASSOC)):
?>
<div class="content">
<table class="left">
<tr>
<th> </th>
<th>R</th>
<th>H</th>
<th>E</th>
<th rowspan="3"><a href="./BoxScore.php"><input id="box" type="button" value="Box Score"></a></th>
</tr>
<tr>
<td><?php echo $row['Visitor']; ?></td>
<td><?php echo $row['visitScore']; ?></td>
<td><?php echo $row['vH']; ?></td>
<td><?php echo $row['vE']; ?></td>
</tr>
<tr>
<td><?php echo $row['Home']; ?></td>
<td><?php echo $row['homeScore']; ?></td>
<td><?php echo $row['hH']; ?></td>
<td><?php echo $row['hE']; ?></td>
</tr>
</table>
</div>
Now, where my issue is coming in. I'm trying to have it so when my "Box Score" button is clicked it redirects the user to a unique Box Score page built with the queried data on my Scores page. Could anyone provide some assistance about how I could/should go about doing this?
I was thinking I could store the date and teams in PHP variables and then be able to query again on the new page using those variables to access that specific game possibly?