Jump to content

$_GET default


Lumit

Recommended Posts

Alright, I'm still having some trouble pinpointing the problem.

 

I'm trying to make a tic-tac-toe script. I'm trying to make it so that if a value hasn't been placed in one of the squares that it will show a text area, and if not it will show the value. But I can't get it to work...

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>php-tac-toe</title>
</head>
<body>
<strong>php-tac-toe</strong>
<?php
$board=array(array("0","0","0"),array("0","0","0"),array("0","0","0"));
$i=0;
$j=0;
echo "<form action=\"phptactoe.php\" method=\"get\">";
echo "<table border=\"1\">";
$board[0][0]=$_GET['00'];
$board[0][1]=$_GET['01'];
$board[0][2]=$_GET['02'];
$board[1][0]=$_GET['10'];
$board[1][1]=$_GET['11'];
$board[1][2]=$_GET['12'];
$board[2][0]=$_GET['20'];
$board[2][1]=$_GET['21'];
$board[2][2]=$_GET['22'];
for($i=0;$i<3;$i+=1)
{
echo "<tr>";
for($j=0;$j<3;$j+=1)
	{
	echo "<td>";
	if ($board[$i][$j]="0")
		{
		echo "<input name=\""."$i"."$j"."\" type=\"text\" size=\"1\" maxlength=\"1\"/>";
		}
	else
		{
		echo $board[$i][$j];
		}
	echo "</td>";
	}
echo "</tr>";
}
echo "</table>";
echo "<input type=\"submit\" value=\"send\" />";
?>
</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/108774-_get-default/#findComment-558498
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.