質問編集履歴
1
書籍の改善
test
CHANGED
File without changes
|
test
CHANGED
@@ -64,6 +64,170 @@
|
|
64
64
|
|
65
65
|
|
66
66
|
|
67
|
+
$stmt = $dbh->prepare('SELECT type1 FROM type WHERE id=?');
|
68
|
+
|
69
|
+
$stmt->bindValue(1,$id,PDO::PARAM_INT);
|
70
|
+
|
71
|
+
$stmt->execute();
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
foreach($stmt as $rec){
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
$type1 = $rec["type1"];
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
$str = <<<EOM
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
<script type="text/javascript">
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
var type1 = '$type1';
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
function addOption1() {
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
var select = document.getElementById("type1");
|
100
|
+
|
101
|
+
var option = document.createElement("option");
|
102
|
+
|
103
|
+
option.text = type1;
|
104
|
+
|
105
|
+
option.value = type1;
|
106
|
+
|
107
|
+
select.appendChild(option);
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
}
|
112
|
+
|
113
|
+
addOption1();
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
function clickType1(type1) {
|
126
|
+
|
127
|
+
$stmt = $dbh->prepare('SELECT type2 FROM type WHERE id=? AND type1=?');
|
128
|
+
|
129
|
+
$stmt->bindValue(1,$id,PDO::PARAM_INT);
|
130
|
+
|
131
|
+
$stmt->bindValue(1,$type1,PDO::PARAM_STR);
|
132
|
+
|
133
|
+
$stmt->execute();
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
foreach($stmt as $rec){
|
138
|
+
|
139
|
+
$type2 = $rec["type2"];
|
140
|
+
|
141
|
+
var type2 = '$type2';
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
function addOption2() {
|
146
|
+
|
147
|
+
var select2 = document.getElementById("type2");
|
148
|
+
|
149
|
+
var option2 = document.createElement("option");
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
option2.text = type2;
|
154
|
+
|
155
|
+
option2.value = type2;
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
select2.appendChild(option2);
|
160
|
+
|
161
|
+
}
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
}
|
166
|
+
|
167
|
+
}
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
addOption2();
|
172
|
+
|
173
|
+
</script>
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
EOM;
|
178
|
+
|
179
|
+
echo $str;
|
180
|
+
|
181
|
+
}
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
?>
|
186
|
+
|
187
|
+
```
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
色々試してみて問題なく動いた部分のコード
|
194
|
+
|
195
|
+
<option value="0" onClick="clickType1(type1)">選択してください</option>は怪しかったです
|
196
|
+
|
197
|
+
```ここに言語を入力
|
198
|
+
|
199
|
+
<select name="type1" id="type1">
|
200
|
+
|
201
|
+
<option value="0" onClick="clickType1(type1)">選択してください</option>
|
202
|
+
|
203
|
+
</select>
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
<br>
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
<select name="type2" id="type2">
|
212
|
+
|
213
|
+
<option value="0" >選択してください</option>
|
214
|
+
|
215
|
+
</select>
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
<?php
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
ini_set('display_errors', "On");
|
228
|
+
|
229
|
+
|
230
|
+
|
67
231
|
$stmt = $dbh->prepare('SELECT * FROM type WHERE id=?');
|
68
232
|
|
69
233
|
$stmt->bindValue(1,$id,PDO::PARAM_INT);
|
@@ -114,13 +278,17 @@
|
|
114
278
|
|
115
279
|
|
116
280
|
|
117
|
-
|
281
|
+
```
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
|
118
|
-
|
289
|
+
エラーがでてしまいどうしてもうまくいかない部分
|
290
|
+
|
119
|
-
|
291
|
+
```ここに言語を入力
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
292
|
|
125
293
|
function clickType1(type1) {
|
126
294
|
|
@@ -185,171 +353,3 @@
|
|
185
353
|
?>
|
186
354
|
|
187
355
|
```
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
色々試してみて問題なく動いた部分のコード
|
194
|
-
|
195
|
-
<option value="0" onClick="clickType1(type1)">選択してください</option>は怪しかったです
|
196
|
-
|
197
|
-
```ここに言語を入力
|
198
|
-
|
199
|
-
<select name="type1" id="type1">
|
200
|
-
|
201
|
-
<option value="0" onClick="clickType1(type1)">選択してください</option>
|
202
|
-
|
203
|
-
</select>
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
<br>
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
<select name="type2" id="type2">
|
212
|
-
|
213
|
-
<option value="0" >選択してください</option>
|
214
|
-
|
215
|
-
</select>
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
<?php
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
ini_set('display_errors', "On");
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
$stmt = $dbh->prepare('SELECT * FROM type WHERE id=?');
|
232
|
-
|
233
|
-
$stmt->bindValue(1,$id,PDO::PARAM_INT);
|
234
|
-
|
235
|
-
$stmt->execute();
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
foreach($stmt as $rec){
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
$type1 = $rec["type1"];
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
$str = <<<EOM
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
<script type="text/javascript">
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
var type1 = '$type1';
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
function addOption1() {
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
var select = document.getElementById("type1");
|
264
|
-
|
265
|
-
var option = document.createElement("option");
|
266
|
-
|
267
|
-
option.text = type1;
|
268
|
-
|
269
|
-
option.value = type1;
|
270
|
-
|
271
|
-
select.appendChild(option);
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
}
|
276
|
-
|
277
|
-
addOption1();
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
```
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
エラーがでてしまいどうしてもうまくいかない部分
|
290
|
-
|
291
|
-
```ここに言語を入力
|
292
|
-
|
293
|
-
function clickType1(type1) {
|
294
|
-
|
295
|
-
$stmt = $dbh->prepare('SELECT type2 FROM type WHERE id=? AND type1=?');
|
296
|
-
|
297
|
-
$stmt->bindValue(1,$id,PDO::PARAM_INT);
|
298
|
-
|
299
|
-
$stmt->bindValue(1,$type1,PDO::PARAM_STR);
|
300
|
-
|
301
|
-
$stmt->execute();
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
foreach($stmt as $rec){
|
306
|
-
|
307
|
-
$type2 = $rec["type2"];
|
308
|
-
|
309
|
-
var type2 = '$type2';
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
function addOption2() {
|
314
|
-
|
315
|
-
var select2 = document.getElementById("type2");
|
316
|
-
|
317
|
-
var option2 = document.createElement("option");
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
option2.text = type2;
|
322
|
-
|
323
|
-
option2.value = type2;
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
select2.appendChild(option2);
|
328
|
-
|
329
|
-
}
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
}
|
334
|
-
|
335
|
-
}
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
addOption2();
|
340
|
-
|
341
|
-
</script>
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
EOM;
|
346
|
-
|
347
|
-
echo $str;
|
348
|
-
|
349
|
-
}
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
?>
|
354
|
-
|
355
|
-
```
|