Ich bin anfänger in php und soll minesweeper programieren
Mein bisheriger code sieht so aus und weiter komm ich nicht:
<?php
$buttons1 = array(
0 => '.',
1 => '.',
2 => '.',
3 => '.',
4 => '.',
5 => '.',
6 => '.',
7 => '.',
8 => '.',
9 => '.',
10 => '.',
);
$buttons2 = array(
0 => '.',
1 => '.',
2 => '.',
3 => '.',
4 => '.',
5 => '.',
6 => '.',
7 => '.',
8 => '.',
9 => '.',
10 => '.',
);
$buttons3 = array(
0 => '.',
1 => '.',
2 => '.',
3 => '.',
4 => '.',
5 => '.',
6 => '.',
7 => '.',
8 => '.',
9 => '.',
10 => '.',
);
$buttons4 = array(
0 => '.',
1 => '.',
2 => '.',
3 => '.',
4 => '.',
5 => '.',
6 => '.',
7 => '.',
8 => '.',
9 => '.',
10 => '.',
);
$buttons5 = array(
0 => '.',
1 => '.',
2 => '.',
3 => '.',
4 => '.',
5 => '.',
6 => '.',
7 => '.',
8 => '.',
9 => '.',
10 => '.',
);
$buttons6 = array(
0 => '.',
1 => '.',
2 => '.',
3 => '.',
4 => '.',
5 => '.',
6 => '.',
7 => '.',
8 => '.',
9 => '.',
10 => '.',
);
$buttons7 = array(
0 => '.',
1 => '.',
2 => '.',
3 => '.',
4 => '.',
5 => '.',
6 => '.',
7 => '.',
8 => '.',
9 => '.',
10 => '.',
);
$buttons8 = array(
0 => '.',
1 => '.',
2 => '.',
3 => '.',
4 => '.',
5 => '.',
6 => '.',
7 => '.',
8 => '.',
9 => '.',
10 => '.',
);
$buttons9 = array(
0 => '.',
1 => '.',
2 => '.',
3 => '.',
4 => '.',
5 => '.',
6 => '.',
7 => '.',
8 => '.',
9 => '.',
10 => '.',
);
$buttons10 = array(
0 => '.',
1 => '.',
2 => '.',
3 => '.',
4 => '.',
5 => '.',
6 => '.',
7 => '.',
8 => '.',
9 => '.',
10 => '.',
);
?>
<form id="option" action="Minesweeper.php" name="option" method="post">
<?php
foreach ($buttons1 as $buttonValue)
{
echo '<input type="submit" value="'.$buttonValue.'" name="value">';
}
?>
<br>
<?php
foreach ($buttons2 as $buttonValue)
{
echo '<input type="submit" value="'.$buttonValue.'" name="value">';
}
?>
<br>
<?php
foreach ($buttons3 as $buttonValue)
{
echo '<input type="submit" value="'.$buttonValue.'" name="value">';
}
?>
<br>
<?php
foreach ($buttons4 as $buttonValue)
{
echo '<input type="submit" value="'.$buttonValue.'" name="value">';
}
?>
<br>
<?php
foreach ($buttons5 as $buttonValue)
{
echo '<input type="submit" value="'.$buttonValue.'" name="value">';
}
?>
<br>
<?php
foreach ($buttons6 as $buttonValue)
{
echo '<input type="submit" value="'.$buttonValue.'" name="value">';
}
?>
<br>
<?php
foreach ($buttons7 as $buttonValue)
{
echo '<input type="submit" value="'.$buttonValue.'" name="value">';
}
?>
<br>
<?php
foreach ($buttons8 as $buttonValue)
{
echo '<input type="submit" value="'.$buttonValue.'" name="value">';
}
?>
<br>
<?php
foreach ($buttons9 as $buttonValue)
{
echo '<input type="submit" value="'.$buttonValue.'" name="value">';
}
?>
<br>
<?php
foreach ($buttons10 as $buttonValue)
{
echo '<input type="submit" value="'.$buttonValue.'" name="value">';
}
?>
</form>
Mein bisheriger code sieht so aus und weiter komm ich nicht:
<?php
$buttons1 = array(
0 => '.',
1 => '.',
2 => '.',
3 => '.',
4 => '.',
5 => '.',
6 => '.',
7 => '.',
8 => '.',
9 => '.',
10 => '.',
);
$buttons2 = array(
0 => '.',
1 => '.',
2 => '.',
3 => '.',
4 => '.',
5 => '.',
6 => '.',
7 => '.',
8 => '.',
9 => '.',
10 => '.',
);
$buttons3 = array(
0 => '.',
1 => '.',
2 => '.',
3 => '.',
4 => '.',
5 => '.',
6 => '.',
7 => '.',
8 => '.',
9 => '.',
10 => '.',
);
$buttons4 = array(
0 => '.',
1 => '.',
2 => '.',
3 => '.',
4 => '.',
5 => '.',
6 => '.',
7 => '.',
8 => '.',
9 => '.',
10 => '.',
);
$buttons5 = array(
0 => '.',
1 => '.',
2 => '.',
3 => '.',
4 => '.',
5 => '.',
6 => '.',
7 => '.',
8 => '.',
9 => '.',
10 => '.',
);
$buttons6 = array(
0 => '.',
1 => '.',
2 => '.',
3 => '.',
4 => '.',
5 => '.',
6 => '.',
7 => '.',
8 => '.',
9 => '.',
10 => '.',
);
$buttons7 = array(
0 => '.',
1 => '.',
2 => '.',
3 => '.',
4 => '.',
5 => '.',
6 => '.',
7 => '.',
8 => '.',
9 => '.',
10 => '.',
);
$buttons8 = array(
0 => '.',
1 => '.',
2 => '.',
3 => '.',
4 => '.',
5 => '.',
6 => '.',
7 => '.',
8 => '.',
9 => '.',
10 => '.',
);
$buttons9 = array(
0 => '.',
1 => '.',
2 => '.',
3 => '.',
4 => '.',
5 => '.',
6 => '.',
7 => '.',
8 => '.',
9 => '.',
10 => '.',
);
$buttons10 = array(
0 => '.',
1 => '.',
2 => '.',
3 => '.',
4 => '.',
5 => '.',
6 => '.',
7 => '.',
8 => '.',
9 => '.',
10 => '.',
);
?>
<form id="option" action="Minesweeper.php" name="option" method="post">
<?php
foreach ($buttons1 as $buttonValue)
{
echo '<input type="submit" value="'.$buttonValue.'" name="value">';
}
?>
<br>
<?php
foreach ($buttons2 as $buttonValue)
{
echo '<input type="submit" value="'.$buttonValue.'" name="value">';
}
?>
<br>
<?php
foreach ($buttons3 as $buttonValue)
{
echo '<input type="submit" value="'.$buttonValue.'" name="value">';
}
?>
<br>
<?php
foreach ($buttons4 as $buttonValue)
{
echo '<input type="submit" value="'.$buttonValue.'" name="value">';
}
?>
<br>
<?php
foreach ($buttons5 as $buttonValue)
{
echo '<input type="submit" value="'.$buttonValue.'" name="value">';
}
?>
<br>
<?php
foreach ($buttons6 as $buttonValue)
{
echo '<input type="submit" value="'.$buttonValue.'" name="value">';
}
?>
<br>
<?php
foreach ($buttons7 as $buttonValue)
{
echo '<input type="submit" value="'.$buttonValue.'" name="value">';
}
?>
<br>
<?php
foreach ($buttons8 as $buttonValue)
{
echo '<input type="submit" value="'.$buttonValue.'" name="value">';
}
?>
<br>
<?php
foreach ($buttons9 as $buttonValue)
{
echo '<input type="submit" value="'.$buttonValue.'" name="value">';
}
?>
<br>
<?php
foreach ($buttons10 as $buttonValue)
{
echo '<input type="submit" value="'.$buttonValue.'" name="value">';
}
?>
</form>