teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

1

調整

2021/12/27 08:28

投稿

yambejp
yambejp

スコア117919

answer CHANGED
@@ -1,1 +1,18 @@
1
- 単純にtrもthもforeachの中に入れ込んでしまえばよいのでは?
1
+ 単純にtrもthもforeachの中に入れ込んでしまえばよいのでは?
2
+
3
+ ```PHP
4
+ <?php
5
+ foreach ( $menu1 as $value ) {
6
+ $send = $value[ 'send' ];
7
+ $id = $value[ 'ID' ];
8
+ $text = $value[ 'text' ];
9
+ ?>
10
+ <tr>
11
+ <th scope="row" class="cf"><img src="●●.webp" alt=""/>メニュー名1</th>
12
+ <td><input type="radio" name="menu" value="<?=$send?>" id="radio<?=$id?>" <?=(isset($menu) && $menu == "$send")?"checked":""?>/>
13
+ <label for="radio<?=$id?>" class="radio"><?=$text?></label></td>
14
+ </tr>
15
+ <?php
16
+ }
17
+ ?>
18
+ ```