1 回答

TA貢獻1757條經驗 獲得超7個贊
我不確定 iframe 的目的是什么。如果您將字段重命名為使用下劃線而不是逗號,則以下代碼應打印單擊按鈕的值。
<?php
if($_SERVER['REQUEST_METHOD'] == 'POST'){
$value = $_POST['field'];
echo $value;
}
$aww_ar = array();
// SELECT PLAYING FIELD ValLUES
$th = 10;
$tw = 10;
// Amount of numbers
$amount = 5;
// Create 2d array
for($y = 0; $y < $th; $y++){
for($x = 0; $x < $tw; $x++){
$randomise = rand(1,$amount);
$aww_ar[$x][$y] = $randomise ;
}
}
// create 2d table array
?>
<form method="post">
<table>
<?php
foreach ($aww_ar as $x=>&$value) {
echo"<tr>";
foreach ($aww_ar[0] as $y=>$v) {
echo "<td><input type='submit' name='field' value='".$aww_ar[$x][$y]."'></td>";
}
echo"</tr>";
}
?>
</table>
</form>
請注意,代碼假定您的 post 數(shù)組中只有一個變量。
- 1 回答
- 0 關注
- 87 瀏覽
添加回答
舉報