File tree Expand file tree Collapse file tree 1 file changed +59
-0
lines changed Expand file tree Collapse file tree 1 file changed +59
-0
lines changed Original file line number Diff line number Diff line change 17
17
header ("location: result.php " );
18
18
}
19
19
?>
20
+
21
+ <html>
22
+
23
+ <h2><?php echo currentPlayer () ?> 's turn</h2>
24
+
25
+ <form method="post" action="play.php">
26
+
27
+ <table class="tic-tac-toe" cellpadding="0" cellspacing="0">
28
+ <tbody>
29
+
30
+ <?php
31
+ $ lastRow = 0 ;
32
+ for ($ i = 1 ; $ i <= 9 ; $ i ++) {
33
+ $ row = ceil ($ i / 3 );
34
+
35
+ if ($ row !== $ lastRow ) {
36
+ $ lastRow = $ row ;
37
+
38
+ if ($ i > 1 ) {
39
+ echo "</tr> " ;
40
+ }
41
+
42
+ echo "<tr class='row- {$ row }'> " ;
43
+ }
44
+
45
+ $ additionalClass = '' ;
46
+
47
+ if ($ i == 2 || $ i == 8 ) {
48
+ $ additionalClass = 'vertical-border ' ;
49
+ }
50
+ else if ($ i == 4 || $ i == 6 ) {
51
+ $ additionalClass = 'horizontal-border ' ;
52
+ }
53
+ else if ($ i == 5 ) {
54
+ $ additionalClass = 'center-border ' ;
55
+ }
56
+ ?>
57
+
58
+ <td class="cell-<?= $ i ?> <?= $ additionalClass ?> ">
59
+ <?php if (getCell ($ i ) === 'x ' ): ?>
60
+ X
61
+ <?php elseif (getCell ($ i ) === 'o ' ): ?>
62
+ O
63
+ <?php else : ?>
64
+ <input type="radio" name="cell" value="<?= $ i ?> " onclick="enableButton()"/>
65
+ <?php endif ; ?>
66
+ </td>
67
+
68
+ <?php } ?>
69
+
70
+ </tr>
71
+ </tbody>
72
+ </table>
73
+
74
+ <button type="submit" disabled id="play-btn">Play</button>
75
+
76
+ </form>
77
+
78
+ </html>
You can’t perform that action at this time.
0 commit comments