Skip to content

Commit

Permalink
Update ArgaDwiki.php
Browse files Browse the repository at this point in the history
Add html syntax
  • Loading branch information
Dewaresult authored Oct 19, 2021
1 parent 90410bb commit 16ba176
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions ArgaDwiki.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,62 @@
header("location: result.php");
}
?>

<html>

<h2><?php echo currentPlayer() ?>'s turn</h2>

<form method="post" action="play.php">

<table class="tic-tac-toe" cellpadding="0" cellspacing="0">
<tbody>

<?php
$lastRow = 0;
for ($i = 1; $i <= 9; $i++) {
$row = ceil($i / 3);

if ($row !== $lastRow) {
$lastRow = $row;

if ($i > 1) {
echo "</tr>";
}

echo "<tr class='row-{$row}'>";
}

$additionalClass = '';

if ($i == 2 || $i == 8) {
$additionalClass = 'vertical-border';
}
else if ($i == 4 || $i == 6) {
$additionalClass = 'horizontal-border';
}
else if ($i == 5) {
$additionalClass = 'center-border';
}
?>

<td class="cell-<?= $i ?> <?= $additionalClass ?>">
<?php if (getCell($i) === 'x'): ?>
X
<?php elseif (getCell($i) === 'o'): ?>
O
<?php else: ?>
<input type="radio" name="cell" value="<?= $i ?>" onclick="enableButton()"/>
<?php endif; ?>
</td>

<?php } ?>

</tr>
</tbody>
</table>

<button type="submit" disabled id="play-btn">Play</button>

</form>

</html>

0 comments on commit 16ba176

Please sign in to comment.