質問編集履歴
4
内容修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -19,8 +19,11 @@
|
|
19
19
|
|
20
20
|
ほしい結果↓
|
21
21
|
<input type= 'checkbox' name='1' value='1' checked >
|
22
|
+
<input type= 'checkbox' name='1' value='2'>
|
22
23
|
<input type= 'checkbox' name='3' value='3' checked >
|
24
|
+
<input type= 'checkbox' name='1' value='4'>
|
23
25
|
<input type= 'checkbox' name='5' value='5' checked >
|
26
|
+
<input type= 'checkbox' name='1' value='6'>
|
24
27
|
|
25
28
|
上記のコードで問題ないでしょうか?
|
26
29
|
|
3
内容修正。
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,17 +1,18 @@
|
|
1
1
|
```PHP
|
2
2
|
$array = array("1", "3", "5");
|
3
3
|
while($row = $resList->fetchRow()){
|
4
|
-
|
4
|
+
if (array_search($row[0], (array)$array) !== FALSE)
|
5
|
-
|
5
|
+
{
|
6
|
-
|
6
|
+
echo "<input type= 'checkbox' name='[$row[0]]' value='$row[0]' checked >";
|
7
|
-
|
8
|
-
|
7
|
+
}
|
9
|
-
|
8
|
+
else {echo "<input type= 'checkbox' name='[$row[0]]' value='$row[0]' >";}
|
10
9
|
}
|
11
10
|
```
|
12
11
|
丸投げですみません。PHP初心者です。
|
13
12
|
|
13
|
+
$row=array("1", "2", "3","4", "5", "6");
|
14
|
-
|
14
|
+
です。
|
15
|
+
|
15
16
|
$arrayの1、3、5と$row[0]が一致する場合のみ
|
16
17
|
echo "<input type= 'checkbox' name='[$row[0]]' value='$row[0]' checked >";
|
17
18
|
を出力したいです。
|
@@ -21,5 +22,6 @@
|
|
21
22
|
<input type= 'checkbox' name='3' value='3' checked >
|
22
23
|
<input type= 'checkbox' name='5' value='5' checked >
|
23
24
|
|
24
|
-
|
25
|
+
上記のコードで問題ないでしょうか?
|
26
|
+
|
25
27
|
よろしくお願いいたします。
|
2
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -3,10 +3,10 @@
|
|
3
3
|
while($row = $resList->fetchRow()){
|
4
4
|
if (array_search($row[0], (array)$hoge) !== FALSE)
|
5
5
|
{
|
6
|
-
echo "<input type= 'checkbox' name='[$row[0]]' value='$row[0]' checked >
|
6
|
+
echo "<input type= 'checkbox' name='[$row[0]]' value='$row[0]' checked >";
|
7
7
|
|
8
8
|
}
|
9
|
-
else {echo "<input type= 'checkbox' name='[$row[0]]' value='$row[0]' >
|
9
|
+
else {echo "<input type= 'checkbox' name='[$row[0]]' value='$row[0]' >";}
|
10
10
|
}
|
11
11
|
```
|
12
12
|
丸投げですみません。PHP初心者です。
|
1
内容修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
```PHP
|
2
2
|
$array = array("1", "3", "5");
|
3
|
-
|
3
|
+
while($row = $resList->fetchRow()){
|
4
4
|
if (array_search($row[0], (array)$hoge) !== FALSE)
|
5
5
|
{
|
6
6
|
echo "<input type= 'checkbox' name='[$row[0]]' value='$row[0]' checked >$row[1]";
|
7
7
|
|
8
8
|
}
|
9
9
|
else {echo "<input type= 'checkbox' name='[$row[0]]' value='$row[0]' >$row[1]";}
|
10
|
-
|
10
|
+
}
|
11
11
|
```
|
12
12
|
丸投げですみません。PHP初心者です。
|
13
13
|
|