I'm working on designing a large form, to which there are 4 different entries in the form that are a series of check boxes, and I'm basically trying to make the code more manageable for later on. Here is how I defined a function for this:
function ogame()
{
echo "<center><table><tr>";
$i = 0;
$sql = "SELECT * From lgame";
$result = mysql_query($sql, $dbcnx);
while($row = mysql_fetch_array($result))
{
$i++;
$name = $row['name'];
echo "<td><input type='checkbox' name='ogame' value='$name' />$name</td>";
if ($i == 2)
{
$i = 0;
echo "</tr><tr>";
}
}
echo "</tr></table></center>";
}
The problem I'm running into is when I call the function, it doesn't do anything. Any help would be appreciated, I'm thinking maybe it needs to be defined as something other then a function, but not sure. Everything works when not in a function, but not when I try doing it this way. Thanks.