matchTable.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. include_once __DIR__ . '/webDbConnection.php';
  3. $conn = new WebDbConnection( );
  4. $countryId = $_POST['countrySelector'];
  5. $leagueId = $_POST['leagueSelector'];
  6. $matches = $conn->getMatches($countryId, $leagueId);
  7. ?>
  8. <head>
  9. <link rel="stylesheet" href="style.css">
  10. </head>
  11. <body>
  12. <table id="matchTable">
  13. <thead>
  14. <tr>
  15. <th>Datum</th>
  16. <th>Hemma lag</th>
  17. <th>Borta lag</th>
  18. <th>Odds 1</th>
  19. <th>(Odds X)</th>
  20. <th>Odds 2</th>
  21. <th>Bet home (true)/away (false)</th>
  22. <th>Bet Odds</th>
  23. <th>Bet Amount</th>
  24. <th>&nbsp;</th>
  25. </tr>
  26. </thead>
  27. <tbody>
  28. <?php
  29. foreach ($matches as $match) {
  30. echo "<form action='makeBet.php' method='post'>";
  31. echo "<tr>";
  32. echo "<td><input hidden id='gameId' name='gameIdName' value='" . $match['id'] . "'/>";
  33. echo "<td>".$match['gameDate'] . "</td>";
  34. echo "<td>".$match['homeTeamName'] . "</td>";
  35. echo "<td>".$match['awayTeamName'] . "</td>";
  36. echo "<td>". round(100 / $match['homeWinPercent'], 2) . "</td>";
  37. echo "<td>". round(100 / $match['drawPercent'], 2) . "</td>";
  38. echo "<td>". round(100 / $match['awayWinPercent'], 2) . "</td>";
  39. echo "<td><input id='betHome' name='betHomeName' type='checkbox'/></td>";
  40. echo "<td><input id='betOdds' name='betOddsName' type='number' step='.01'/></td>";
  41. echo "<td><input id='betAmount' name='betAmountName' type='number' step='.01'/></td>";
  42. echo "<td><input id='button' type='submit'/></td>";
  43. echo "</form>";
  44. echo "</tr>";
  45. }
  46. ?>
  47. </tbody>
  48. </table>
  49. </body>