質問編集履歴

1

投稿ミス

2020/09/12 08:34

投稿

hayatonbi94
hayatonbi94

スコア6

test CHANGED
@@ -1 +1 @@
1
- チェックボックスでチェックされたデータを引数としてPHPに渡す。
1
+ 投稿ミスです。すみません。
test CHANGED
@@ -1,561 +1 @@
1
- <前提 実現したい事>
2
-
3
-
4
-
5
- 検索ボタンを押下後、チェックボックスにチェックされているデータを引数でphpに渡したいです。
6
-
7
- htmlコードになります。チェックボックスがあるコードです。
8
-
9
- ```php
10
-
11
- コード<?php
12
-
13
-
14
-
15
- //データベース接続
16
-
17
- $dsn = 'mysql:dbname=!!!;host=localhost';
18
-
19
- $user = '^^^';
20
-
21
- $password = '1111111';
22
-
23
- $dbh = new PDO($111,$11,$111);
24
-
25
-
26
-
27
- $sql = "SELECT * FROM user";
28
-
29
-
30
-
31
- $result = $dbh -> query($sql);
32
-
33
-
34
-
35
- //クエリー失敗
36
-
37
- if(!$result) {
38
-
39
- echo $dbh->error;
40
-
41
- exit();
42
-
43
- }
44
-
45
-
46
-
47
- //レコード件数
48
-
49
- $row_cnt = $result->rowCount();
50
-
51
-
52
-
53
- ///連想配列で取得
54
-
55
- $sth = $dbh -> query($sql);
56
-
57
- $aryList = $sth -> fetchAll(PDO::FETCH_ASSOC);
58
-
59
- ?>
60
-
61
-
62
-
63
-
64
-
65
- <html>
66
-
67
- <head>
68
-
69
- <link rel="stylesheet" type="text/css" href="/css/search.css">
70
-
71
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
72
-
73
- <title>ユーザー詳細情報画面</title>
74
-
75
- </head>
76
-
77
- <body>
78
-
79
- <h1>テスト用表示画面</h1>
80
-
81
- <?php
82
-
83
- $food = $_POST['food'];
84
-
85
- ?>
86
-
87
- <?php
88
-
89
- foreach($aryList as $aryList){
90
-
91
- ?>
92
-
93
- <table border="1" width="80%" bordercolor="#green" bgcolor="#f5f5f5">
94
-
95
- <tr bgcolor="deepskyblue">
96
-
97
- <td>ユーザ名</td>
98
-
99
- </tr>
100
-
101
- <tr>
102
-
103
- <td><?php echo htmlspecialchars($aryList['user_name'],ENT_QUOTES,'UTF-8'); ?></td>
104
-
105
- </tr>
106
-
107
- <tr bgcolor="deepskyblue">
108
-
109
- <td>希望する活動場所</td>
110
-
111
- </tr>
112
-
113
- <tr>
114
-
115
- <td><?php echo htmlspecialchars($aryList['place'],ENT_QUOTES,'UTF-8'); ?></td>
116
-
117
- </tr>
118
-
119
- <tr bgcolor="deepskyblue">
120
-
121
- <td>使用できるプログラミング言語</td>
122
-
123
- </tr>
124
-
125
- <tr>
126
-
127
- <td>
128
-
129
- <?php echo htmlspecialchars($aryList['language_html'].' ',ENT_QUOTES,'UTF-8'); ?>
130
-
131
- <?php echo htmlspecialchars($aryList['language_css'].' ',ENT_QUOTES,'UTF-8'); ?>
132
-
133
- <?php echo htmlspecialchars($aryList['language_php'].' ',ENT_QUOTES,'UTF-8'); ?>
134
-
135
- <?php echo htmlspecialchars($aryList['language_javasprict'].' ',ENT_QUOTES,'UTF-8'); ?>
136
-
137
- <?php echo htmlspecialchars($aryList['language_ruby'].' ',ENT_QUOTES,'UTF-8'); ?>
138
-
139
- <?php echo htmlspecialchars($aryList['language_python'].' ',ENT_QUOTES,'UTF-8'); ?>
140
-
141
- <?php echo htmlspecialchars($aryList['language_java'].' ',ENT_QUOTES,'UTF-8'); ?>
142
-
143
- <?php echo htmlspecialchars($aryList['language_go'].' ',ENT_QUOTES,'UTF-8'); ?>
144
-
145
- <?php echo htmlspecialchars($aryList['language_sql'].' ',ENT_QUOTES,'UTF-8'); ?>
146
-
147
- <?php echo htmlspecialchars($aryList['language_c'].' ',ENT_QUOTES,'UTF-8'); ?>
148
-
149
- <?php echo htmlspecialchars($aryList['language_c++'].' ',ENT_QUOTES,'UTF-8'); ?>
150
-
151
- </td>
152
-
153
- </tr>
154
-
155
- <tr bgcolor="deepskyblue">
156
-
157
- <td>実務経験歴</td>
158
-
159
- </tr>
160
-
161
- <tr>
162
-
163
- <td><?php echo htmlspecialchars($aryList['work_experience'],ENT_QUOTES,'UTF-8'); ?></td>
164
-
165
- </tr>
166
-
167
- <tr bgcolor="deepskyblue">
168
-
169
- <td>自分の年齢</td>
170
-
171
- </tr>
172
-
173
- <tr>
174
-
175
- <td><?php echo htmlspecialchars($aryList['my_age'],ENT_QUOTES,'UTF-8'); ?></td>
176
-
177
- </tr>
178
-
179
- <tr bgcolor="deepskyblue">
180
-
181
- <td>相手の希望年齢</td>
182
-
183
- </tr>
184
-
185
- <tr>
186
-
187
- <td>
188
-
189
- <?php echo htmlspecialchars($aryList['you_hope_age_dont_worry'].' ',ENT_QUOTES,'UTF-8'); ?>
190
-
191
- <?php echo htmlspecialchars($aryList['you_hope_age_10s'].' ',ENT_QUOTES,'UTF-8'); ?>
192
-
193
- <?php echo htmlspecialchars($aryList['you_hope_age_early20s'].' ',ENT_QUOTES,'UTF-8'); ?>
194
-
195
- <?php echo htmlspecialchars($aryList['you_hope_age_late20s'].' ',ENT_QUOTES,'UTF-8'); ?>
196
-
197
- <?php echo htmlspecialchars($aryList['you_hope_age_early30s'].' ',ENT_QUOTES,'UTF-8'); ?>
198
-
199
- <?php echo htmlspecialchars($aryList['you_hope_age_late30s'].' ',ENT_QUOTES,'UTF-8'); ?>
200
-
201
- <?php echo htmlspecialchars($aryList['you_hope_age_40s'].' ',ENT_QUOTES,'UTF-8'); ?>
202
-
203
- </td>
204
-
205
- </tr>
206
-
207
- <tr bgcolor="deepskyblue">
208
-
209
- <td>目標</td>
210
-
211
- </tr>
212
-
213
- <tr>
214
-
215
- <td><?php echo htmlspecialchars($aryList['target'],ENT_QUOTES,'UTF-8'); ?></td>
216
-
217
- </tr>
218
-
219
- <tr bgcolor="deepskyblue">
220
-
221
- <td>自己紹介</td>
222
-
223
- </tr>
224
-
225
- <tr>
226
-
227
- <td><?php echo htmlspecialchars($aryList['self_introduction'],ENT_QUOTES,'UTF-8'); ?></td>
228
-
229
- </tr>
230
-
231
- <tr bgcolor="deepskyblue">
232
-
233
- <td>Twitter</td>
234
-
235
- </tr>
236
-
237
- <tr>
238
-
239
- <td><?php echo htmlspecialchars($aryList['twitter'],ENT_QUOTES,'UTF-8'); ?></td>
240
-
241
- </tr>
242
-
243
- <br>
244
-
245
- </table>
246
-
247
- <?php
248
-
249
- }
250
-
251
- ?>
252
-
253
-
254
-
255
-
256
-
257
- </table>
258
-
259
- </body>
260
-
261
- </html>
262
-
263
-
264
-
265
- ```
266
-
267
- ```html
268
-
269
- コード<!DOCTYPE html>
270
-
271
- <html>
272
-
273
- <head>
274
-
275
- <link rel="stylesheet" type="text/css" href="/css/search.css">
276
-
277
- <title>エンジニアマッチングサイト</title>
278
-
279
- </head>
280
-
281
- <body>
282
-
283
- <div class="header">
284
-
285
- <div class="header-logo">エンジニアマッチング</div>
286
-
287
- </div>
288
-
289
- <div class="main">
290
-
291
- <div class="copy-container">
292
-
293
- <h1>検索画面</h1>
294
-
295
- </div>
296
-
297
- <div class="contentsmain">
298
-
299
- <h1 style="background-color: black;">活動場所(複数回答可)</h1>
300
-
301
- <input type ="text" name="name">
302
-
303
-
304
-
305
- <h1 style="background-color: black;">使用できるプログラング言語(複数選択化)</h1>
1
+ 投稿スになります。すみません。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
306
-
307
- <label for="check1">HTML</label>
308
-
309
- <input type="checkbox" id="check1">
310
-
311
- <label for="check1">CSS</label>
312
-
313
- <input type="checkbox" id="check1">
314
-
315
- <label for="check1">JavaScript</label>
316
-
317
- <input type="checkbox" id="check1">
318
-
319
- <label for="check1">Ruby</label>
320
-
321
- <input type="checkbox" id="check1">
322
-
323
- <label for="check1">Python</label>
324
-
325
- <input type="checkbox" id="check1">
326
-
327
- <label for="check1">Java</label>
328
-
329
- <input type="checkbox" id="check1">
330
-
331
- <label for="check1">Go</label>
332
-
333
- <input type="checkbox" id="check1">
334
-
335
- <label for="check1">SQL</label>
336
-
337
- <input type="checkbox" id="check1">
338
-
339
- <label for="check1">PHP</label>
340
-
341
- <input type="checkbox" id="check1">
342
-
343
- <label for="check1">C言語</label>
344
-
345
- <input type="checkbox" id="check1">
346
-
347
- <label for="check1">C++</label>
348
-
349
-
350
-
351
- <h1 style="background-color: black;">実務経験歴</h1>
352
-
353
- <input type ="text">
354
-
355
- <h1 style="background-color: black;">相手の年齢</h1>
356
-
357
- <input type="checkbox" id="check1">
358
-
359
- <label for="check1">こだわらない</label>
360
-
361
- <input type="checkbox" id="check1">
362
-
363
- <label for="check1">10代</label>
364
-
365
- <input type="checkbox" id="check1">
366
-
367
- <label for="check1">20代前半</label>
368
-
369
- <input type="checkbox" id="check1">
370
-
371
- <label for="check1">20代後半</label>
372
-
373
- <input type="checkbox" id="check1">
374
-
375
- <label for="check1">30代前半</label>
376
-
377
- <input type="checkbox" id="check1">
378
-
379
- <label for="check1">30代後半</label>
380
-
381
- <input type="checkbox" id="check1">
382
-
383
- <label for="check1">40代以上</label>
384
-
385
- <h1 style="background-color: black;">その他</h1>
386
-
387
- <input type="checkbox" id="check1">
388
-
389
- <label for="check1">プロフィール画像がある</label>
390
-
391
- <h1 style="background-color: black;">気になるワード</h1>
392
-
393
- <form name="form">
394
-
395
- <input name="text1" id="text1" type="text">
396
-
397
- </form>
398
-
399
-  <button type="button" onclick="location.href='http://localhost/index.php'">検索</button>
400
-
401
-
402
-
403
- <p>現在、全205件中205件がヒット!</p>
404
-
405
- </div>
406
-
407
-
408
-
409
- <div class="contentsunder">
410
-
411
- <p id="rank1"><img src="https://www.pakutaso.com/shared/img/thumb/0I9A5582ISUMI.jpg" width="200" height="400"></p>
412
-
413
- <h2>プロフィール画像</h2>
414
-
415
- <table border="1" width="80%" bordercolor="#green" bgcolor="#f5f5f5">
416
-
417
- <tr bgcolor="deepskyblue">
418
-
419
- <td>ユーザー名</td>
420
-
421
- </tr>
422
-
423
- <tr>
424
-
425
- <td>山内まりあ</td>
426
-
427
- </tr>
428
-
429
- <tr bgcolor="deepskyblue">
430
-
431
- <td>希望する活動場所</td>
432
-
433
- </tr>
434
-
435
- <tr>
436
-
437
- <td>東京</td>
438
-
439
- </tr>
440
-
441
- <tr bgcolor="deepskyblue">
442
-
443
- <td>使用できるプログラミング言語</td>
444
-
445
- </tr>
446
-
447
- <tr>
448
-
449
- <td>PHP</td>
450
-
451
- </tr>
452
-
453
- <tr bgcolor="deepskyblue" >
454
-
455
- <td>実務経験歴</td>
456
-
457
- </tr>
458
-
459
- <tr>
460
-
461
- <td>3年</td>
462
-
463
- </tr>
464
-
465
- <tr bgcolor="deepskyblue" >
466
-
467
- <td>自分の年齢</td>
468
-
469
- </tr>
470
-
471
- <tr>
472
-
473
- <td>21歳</td>
474
-
475
- </tr>
476
-
477
- <tr bgcolor="deepskyblue" >
478
-
479
- <td>相手の希望年齢</td>
480
-
481
- </tr>
482
-
483
- <tr>
484
-
485
- <td>20代前半 20代後半</td>
486
-
487
- </tr>
488
-
489
- <tr bgcolor="deepskyblue" >
490
-
491
- <td>目標</td>
492
-
493
- </tr>
494
-
495
- <tr>
496
-
497
- <td>プロジェクトマネージャーになること</td>
498
-
499
- </tr>
500
-
501
- <tr bgcolor="deepskyblue" >
502
-
503
- <td>自己紹介</td>
504
-
505
- </tr>
506
-
507
- <tr>
508
-
509
- <td>元気が取り柄です!よろしくお願いします。</td>
510
-
511
- </tr>
512
-
513
- <tr bgcolor="deepskyblue">
514
-
515
- <td>Twitter</td>
516
-
517
- </tr>
518
-
519
- <tr>
520
-
521
- <td></td>
522
-
523
- </tr>
524
-
525
- </table>
526
-
527
- <div class="contact-form">
528
-
529
- <input type="submit" value="お気に入り芸人解除">
530
-
531
- </div>
532
-
533
- </div>
534
-
535
- </div>
536
-
537
- <script>
538
-
539
- function check() {
540
-
541
- var getText = document.form.text1.value;
542
-
543
- if (getText.length <= 10) {
544
-
545
- alert("送信しました。");
546
-
547
- } else {
548
-
549
- alert("気になるメッセージを10文字以内で入力してください。");
550
-
551
- }
552
-
553
- }
554
-
555
- </script>
556
-
557
- </body>
558
-
559
- </html>
560
-
561
- ```