Skip to content

Commit 16ba176

Browse files
authored
Update ArgaDwiki.php
Add html syntax
1 parent 90410bb commit 16ba176

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

ArgaDwiki.php

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,62 @@
1717
header("location: result.php");
1818
}
1919
?>
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>

0 commit comments

Comments
 (0)