php battleship game not working
<p>Okay, so I have this partially working game, I know the solutions should be simple in terms of game play,but for a noob nothing is ever simple, so here, I am requesting help, as a noob, what am I doing wrong, I think it's the way I setup the check-boxes, but I need other eyes, thank you.</p>

<pre><code>&lt;form action="&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;" method="post" /&gt;
&lt;table border="1" align="center" /&gt;
&lt;?php
$fire = $_REQUEST["fire"];
$variable = $_REQUEST["variable"];
$step = $_REQUEST["step"];
$i = $_REQUEST["i"];
$j = $_REQUEST["j"];

if(isset($_POST['$i$j']))
{ 
echo 'checked';
}

//first there will be script that randomly generate 5 ships for both users

$step = $_POST['step'];
//4 steps of the game
if ($step &gt; 3) 
{
    $step = 1;
} 
else 
{
    $step += 1;
}//end if
//step 1, first player 
if ($step == 1) 
{
    echo "Player 1";
 // Loop through the alphabet from a to j and stop before k on this for loop
    for ($i = a; $i &lt; k; $i++)
 {
 // Print out the table with the letters from a to j using the variable $i
     echo "&lt;tr&gt;&lt;td width='20' align='right'&gt;$i&lt;/td&gt;";
  // Loop through the numbers for $j using numbers from 1 to less than 11 which is 10;
       for ($j = 1; $j &lt; 11; $j++)
    {

    echo "&lt;td&gt;&lt;input type='submit' value='fire' name='$i$j'&gt;&lt;/td&gt;";
       } 
    // end for loop
     echo "&lt;/tr&gt;";
    } 
 // end for loop
    echo "&lt;tr&gt;&lt;td&gt;&lt;/td&gt;";

 for ($j = 1; $j &lt; 11; $j++)
 {

     echo "&lt;td&gt;$j&lt;/td&gt;";
    }
    echo "&lt;/tr&gt;&lt;/table&gt;";
    //step 2 result of first player fire
} 

else if($step == 2)
 {

    echo "Result 1";
        for ($i = a; $i &lt; k; $i++)
  {

     echo "&lt;tr&gt;&lt;td width='20' align='right'&gt;$i&lt;/td&gt;";
       for ($j = 1; $j &lt; 11; $j++){
      //&lt;input type="checkbox" name="state[]" value="NE"&gt;
         echo "&lt;td&gt;&lt;input type='checkbox' type='submit' checked='checked' name='$i$j'&gt;&lt;/td&gt;";
       } // end for loop
     echo "&lt;/tr&gt;";
    } // end for loop
    echo "&lt;tr&gt;&lt;td&gt;&lt;/td&gt;";
    for ($j = 1; $j &lt; 11; $j++){
     echo "&lt;td&gt;$j&lt;/td&gt;";
    }
    echo "&lt;/tr&gt;&lt;/table&gt;&lt;br&gt;&lt;input type='submit' name='' value='Player 2 Turn'&gt;";
    //step 3 second player fireing
} else if($step == 3) {
    echo "Player 2";
    for ($i = a; $i &lt; k; $i++){
     echo "&lt;tr&gt;&lt;td width='20' align='right'&gt;$i&lt;/td&gt;";
       for ($j = 1; $j &lt; 11; $j++){
         echo "&lt;td&gt;&lt;input type='submit' value='fire' name='$i$j'&gt;&lt;/td&gt;";
       } // end for loop
     echo "&lt;/tr&gt;";
    } // end for loop
    echo "&lt;tr&gt;&lt;td&gt;&lt;/td&gt;";
    for ($j = 1; $j &lt; 11; $j++){
     echo "&lt;td&gt;$j&lt;/td&gt;";
    }
    echo "&lt;/tr&gt;&lt;/table&gt;";
    //step 4 result of second player fire
} else {
    echo "Result 2 ";
    for ($i = a; $i &lt; k; $i++){
     echo "&lt;tr&gt;&lt;td width='20' align='right'&gt;$i&lt;/td&gt;";
       for ($j = 1; $j &lt; 11; $j++){
         echo "&lt;td&gt;&lt;input type='checkbox' checked='checked' disabled='disabled' name='$i$j'&gt;&lt;/td&gt;";
       } // end for loop
     echo "&lt;/tr&gt;";
    } // end for loop
    echo "&lt;tr&gt;&lt;td&gt;&lt;/td&gt;";
    for ($j = 1; $j &lt; 11; $j++){
     echo "&lt;td&gt;$j&lt;/td&gt;";
    }
    echo "&lt;/tr&gt;&lt;/table&gt;&lt;br&gt;&lt;input type='submit' name='' value='Player 1 Turn'&gt;";
}//end if
for ($j = 1; $j &lt; 11; $j++){
       if ($checked){
         echo "&lt;td&gt;&lt;input type='checkbox' checked='checked' name='variable'&gt;&lt;/td&gt;";
        } else {
         echo "&lt;td&gt;&lt;input type='checkbox' name='variable'&gt;&lt;/td&gt;";
        }
       }  

?&gt;

&lt;input type="hidden" name="step" value="&lt;?php echo "$step"; ?&gt;"
&lt;/form&gt;
&lt;/center&gt;
&lt;/html&gt;
</code></pre>
