asked on
<?php
$box = array('', '', '', '', '', '', '', '', '');
if (isset($_POST["submitbtn"])) {
$box[0] = $_POST["box0"];
$box[1] = $_POST["box1"];
$box[2] = $_POST["box2"];
$box[3] = $_POST["box3"];
$box[4] = $_POST["box4"];
$box[5] = $_POST["box5"];
$box[6] = $_POST["box6"];
$box[7] = $_POST["box7"];
$box[8] = $_POST["box8"];
echo "<pre>";
print_r($box);
}
?>
<html>
<head>
<title>Tic-Tac-Toe</title>
</head>
<body>
<form name="TicTacToe" method="post" action="test2.php"
<?php
for ($i=0; $i<=8; $i++) {
printf('<input type ="text" name="box%s" value="%s">', $i, $box[$i]);
if($i == 2 || $i == 5 || $i == 8){
print('<br />');
}
}
print('<input type="submit" name="submitbtn" value="Submit">');
?>
</form>
</body>
</html>