質問編集履歴

1

html cssを追記しました。

2023/06/02 02:50

投稿

fsdfsa
fsdfsa

スコア11

test CHANGED
File without changes
test CHANGED
@@ -8,14 +8,323 @@
8
8
  ### 該当のソースコード
9
9
 
10
10
  ```html
11
+ <body>
12
+
13
+ <header>
14
+
15
+ <div class="icon">
16
+ <a href="#">
17
+ <img src="./img/DAWN_icon.png" alt="icon">
18
+ </a>
19
+ </div>
20
+
21
+ <h1>リストの表示<br><span class="sub">-list-</span></h1>
22
+
23
+ </header>
24
+
25
+ <div id="content">
26
+
27
+ <table style="border-collapse: separate">
28
+
29
+ <tr>
30
+ <th class="id">ID</th>
31
+ <th class="name">NAME</th>
32
+ <th class="mail">MAIL</th>
33
+ <th class="up">EDIT</th>
34
+ <th class="dele">DELETE</th>
35
+ </tr>
36
+
37
+ <?php
38
+ if (isset($_POST["search"])){//検索ボタンが押された場合
39
+
40
+ if (isset($_POST["search_name"]))//検索した場合
41
+ {
42
+ $search_name = $_POST["search_name"];
43
+ $sql="SELECT * FROM users WHERE username like '%{$search_name}%'";
44
+ $stmt2 = $pdo->prepare($sql);
45
+ $stmt2->execute();
46
+ $stmt2_list = $stmt2->fetchAll(PDO::FETCH_ASSOC);}
47
+ ?>
48
+ <div class="create_btn">
49
+ <button>
50
+ <a href="list.php"><i class="fas fa-plus-circle"> 一覧表示へ戻る</i></a>
51
+ </button>
52
+ </div>
53
+
54
+ <?php
55
+
56
+ }
57
+
58
+ // 検索しなかった場合
59
+ else {
60
+
61
+ foreach ($result as $list) { ?>
62
+ <tr>
63
+
64
+ <td class="id"><?php echo htmlspecialchars($list["id"]); ?></td>
65
+ <td class="name"><?php echo htmlspecialchars($list["username"]); ?></td>
66
+ <td class="mail"><?php echo htmlspecialchars($list["mail"]); ?></td>
67
+ <td class="up">
68
+ <a href="update_form.php?id=<?php echo $list["id"]?>&username=<?php echo $list["username"]?>&mail=<?php echo $list["mail"] ?>">
69
+ <i class="fas fa-file-alt"></i></a>
70
+ </td>
71
+ <td class="dele">
72
+ <a href="delete.php?id=<?php echo htmlspecialchars($list["id"]); ?>"onclick="return confirm('このレコードを削除します。よろしいでしょうか?')">
73
+ <i class="fas fa-trash-alt"></i> </a>
74
+
75
+ </td>
76
+
77
+ </tr>
78
+
79
+ <?php } ?>
80
+
81
+
82
+ <div class="create_btn">
83
+
84
+ <button>
85
+ <a href="create_form.php"><i class="fas fa-plus-circle"> 新規登録はこちら</i></a>
86
+ </button>
87
+
88
+ </div>
89
+
90
+
91
+ <?php } ?>
92
+
93
+ <!-- 検索した場合のリスト表示 -->
94
+ <?php foreach ($stmt2_list as $serch) { ?>
95
+
96
+ <tr>
97
+
98
+ <td class="id"><?php echo $serch['id'];?></td>
99
+ <td class="name"><?php echo $serch['username'];?></td>
100
+ <td class="mail"><?php echo $serch['mail'];?></td>
101
+ <td class="up">
102
+ <a href="update_form.php?id=<?php echo $serch["id"]; ?>">
103
+ <i class="fas fa-file-alt"></i></a>
104
+ </td>
105
+ <td class="dele">
106
+ <a href="delete.php?id=<?php echo htmlspecialchars($serch["id"]); ?>"onclick="return confirm('このレコードを削除します。よろしいでしょうか?')">
107
+ <i class="fas fa-trash-alt"></i> </a>
108
+ </td>
109
+
110
+ </tr>
111
+
112
+ <?php } ?>
113
+
114
+
115
+ <!-- 検索ファーム -->
116
+
117
+
11
118
  <div id="search">
12
- <form action="list.php" method="post">
119
+ <form action="list.php" method="post"></form>
13
120
  <input type="text" name="search_name" placeholder="ユーザー名で検索" >
14
- <input type="submit" name="search" >
121
+ <input type="submit" name="search" value=検索
122
+ >
15
123
  </form>
124
+
16
125
  </div>
126
+
127
+ </table>
128
+
129
+
130
+ </body>
131
+
132
+ </html>
17
133
  ```
18
134
  ```css
135
+ @charset "utf-8";
136
+
137
+ body {
138
+ background: #d5ecfc;
139
+ color: rgb(80, 80, 80);
140
+ }
141
+
142
+ h1 {
143
+ text-align: center;
144
+ font-size: 24px;
145
+ color: #fff;
146
+ background: #04489b;
147
+ padding: 15px;
148
+ line-height: 1rem;
149
+ }
150
+
151
+ a {
152
+ text-decoration: none;
153
+ }
154
+
155
+ input {
156
+ padding-left: 3px;
157
+ border: 0.5px solid rgb(146, 146, 146);
158
+ border-radius: 3px;
159
+ display: block;
160
+ }
161
+
162
+ #content {
163
+ margin: 15px auto !important;
164
+ overflow: hidden;
165
+ }
166
+
167
+ table {
168
+ max-width: 520px;
169
+ }
170
+
171
+ td {
172
+ padding: 5px;
173
+ font-size: 14px;
174
+ text-align: center;
175
+ margin: 0;
176
+ }
177
+
178
+ .name {
179
+ width: 150px;
180
+ }
181
+
182
+ .pass {
183
+ width: 150px;
184
+ }
185
+
186
+ .up {
187
+ width: 100px;
188
+ }
189
+
190
+ .dele {
191
+ width: 100px;
192
+ }
193
+
194
+ .var_dump {
195
+ padding: 15px;
196
+ background: rgb(224, 255, 224);
197
+ font-size: 16px;
198
+ }
199
+
200
+ .return {
201
+ width: 800px;
202
+ text-align: left;
203
+ margin: 30px auto 0;
204
+ display: block;
205
+ }
206
+
207
+ h2 {
208
+ margin-bottom: 30px;
209
+ ;
210
+ }
211
+
212
+
213
+ /* ==============================================
214
+ Design Plus
215
+ ================================================*/
216
+
217
+
218
+ /* ===================common====================== */
219
+
220
+ header .icon:hover {
221
+ opacity: 0.8;
222
+ }
223
+
224
+ body {
225
+ background: url(../img/bg.jpg) no-repeat;
226
+ background-color: rgba(255, 255, 255, 0.7);
227
+ background-blend-mode: lighten;
228
+ background-size: cover;
229
+ }
230
+
231
+ #content {
232
+ max-width: 900px;
233
+ }
234
+
235
+ form h2 {
236
+ padding: 60px 0;
237
+ font-size: 1.2rem;
238
+ text-align: center;
239
+ }
240
+
241
+ .return {
242
+ width: 100%;
243
+ margin: 0;
244
+ }
245
+
246
+ span.strong {
247
+ font-size: 1.3em;
248
+ }
249
+
250
+ span.orange {
251
+ color: #e2563b;
252
+ font-size: 35px;
253
+ }
254
+
255
+
256
+ /*heder*/
257
+
258
+ header {
259
+ background: -moz-linear-gradient(to bottom, #7b9bc7, #e9cfd4);
260
+ background: -webkit-linear-gradient(to bottom, #7b9bc7, #e9cfd4);
261
+ background: linear-gradient(to bottom, #7b9bc7, #e9cfd4);
262
+ display: flex;
263
+ flex-direction: row;
264
+ position: relative;
265
+ }
266
+
267
+ header .icon {
268
+ width: 100px;
269
+ margin: 19px 19px 0;
270
+ text-align: center;
271
+ position: absolute;
272
+ }
273
+
274
+ header .icon img {
275
+ width: 100%;
276
+ }
277
+
278
+ header h1 {
279
+ width: 100%;
280
+ background: none;
281
+ line-height: 1.1;
282
+ }
283
+
284
+ header h1 span.sub {
285
+ font-size: 0.7em;
286
+ }
287
+
288
+
289
+ /* ===================list====================== */
290
+
291
+
292
+ /*create_btn*/
293
+
294
+ .create_btn {
295
+ margin: 0 auto 20px;
296
+ padding-top: 20px;
297
+ font-size: 14pt;
298
+ }
299
+
300
+ .create_btn button {
301
+ margin: 0;
302
+ position: relative;
303
+ }
304
+
305
+ .create_btn a {
306
+ font-weight: bold;
307
+ color: #e2563b;
308
+ }
309
+
310
+ .create_btn a:hover {
311
+ opacity: 0.7;
312
+ }
313
+
314
+
315
+ /*!empty_return*/
316
+
317
+ p.return_empty a {
318
+ font-weight: bold;
319
+ color: #e2563b;
320
+ }
321
+
322
+ p.return_empty {
323
+ padding-bottom: 30px;
324
+ }
325
+
326
+
327
+ /*search*/
19
328
 
20
329
  #search {
21
330
  float: right;
@@ -37,6 +346,262 @@
37
346
  #search form input::placeholder {
38
347
  font-size: 12pt;
39
348
  }
349
+
350
+ #search button {
351
+ height: 100%;
352
+ width: 50px;
353
+ background: #e2563b;
354
+ color: #fff;
355
+ top: 0;
356
+ right: 0;
357
+ position: absolute;
358
+ }
359
+
360
+ #search button:hover {
361
+ background: #f0907f;
362
+ }
363
+
364
+
365
+
366
+ /*btn*/
367
+
368
+ #search button {
369
+ border-radius: 0 3px 3px 0;
370
+ }
371
+
372
+
373
+ /*list_table*/
374
+
375
+ table {
376
+ border-spacing: 0px 2px;
377
+ max-width: 65%;
378
+ }
379
+
380
+
381
+ /*id_color*/
382
+
383
+ tr:nth-child(n+2) .id {
384
+ background-color: #0083ab;
385
+ color: #fff;
386
+ }
387
+
388
+
389
+ /*Record odd*/
390
+
391
+ tr:nth-child(odd) .name,
392
+ tr:nth-child(odd) .mail,
393
+ tr:nth-child(odd) .up,
394
+ tr:nth-child(odd) .dele {
395
+ background-color: #f5f8fb;
396
+ }
397
+
398
+
399
+ /*Record even*/
400
+
401
+ tr:nth-child(even) .name,
402
+ tr:nth-child(even) .mail,
403
+ tr:nth-child(even) .up,
404
+ tr:nth-child(even) .dele {
405
+ background-color: #fff;
406
+ }
407
+
408
+
409
+ /*category*/
410
+
411
+ tr:first-child .id,
412
+ tr:first-child .name,
413
+ tr:first-child .mail,
414
+ tr:first-child .up,
415
+ tr:first-child .dele {
416
+ height: 40px;
417
+ background: #016079;
418
+ color: #fff;
419
+ font-size: 0.5em;
420
+ position: relative;
421
+ }
422
+
423
+ tr:first-child .id,
424
+ tr:first-child .up,
425
+ tr:first-child .dele {
426
+ width: 10%;
427
+ }
428
+
429
+ tr:first-child .mail {
430
+ width: 40%;
431
+ }
432
+
433
+ tr:first-child td.id:after,
434
+ tr:first-child td.name:after,
435
+ tr:first-child td.mail:after,
436
+ tr:first-child td.up:after {
437
+ height: 80%;
438
+ width: 1px;
439
+ content: "";
440
+ top: 10%;
441
+ right: 0;
442
+ position: absolute;
443
+ background-color: #fff;
444
+ }
445
+
446
+
447
+ /*EDIT DELETE_iconColor*/
448
+
449
+ tr:nth-child(n+2) .up a,
450
+ tr:nth-child(n+2) .dele a {
451
+ color: #e2563b;
452
+ font-size: 1.3em;
453
+ }
454
+
455
+ tr:nth-child(n+2) .up a:hover,
456
+ tr:nth-child(n+2) .dele a:hover {
457
+ color: #f0907f;
458
+ font-size: 1.3em;
459
+ }
460
+
461
+ tr {
462
+ margin-bottom: 5px;
463
+ overflow: hidden;
464
+ }
465
+
466
+ .update_text {
467
+ font-size: 35px;
468
+ }
469
+
470
+ /* ===================form====================== */
471
+
472
+
473
+ /*form_input*/
474
+
475
+ .form_input input {
476
+ width: 300px;
477
+ background: #fff;
478
+ border: solid 2px #e2563b;
479
+ border-radius: 3px;
480
+ }
481
+
482
+
483
+ /*username*/
484
+
485
+ .form_input .username label {
486
+ padding-left: 25px;
487
+ font-weight: bold;
488
+ color: #0e1d44;
489
+ position: relative;
490
+ }
491
+
492
+ .form_input .username label:before {
493
+ content: "";
494
+ width: 20px;
495
+ height: 30px;
496
+ bottom: -5px;
497
+ left: 3px;
498
+ background: url(../img/icon_man.png) no-repeat;
499
+ position: absolute;
500
+ }
501
+
502
+
503
+ /*mail*/
504
+
505
+ .form_input .mail label {
506
+ padding-left: 35px;
507
+ font-weight: bold;
508
+ color: #0e1d44;
509
+ position: relative;
510
+ }
511
+
512
+ .form_input .mail label:before {
513
+ content: "";
514
+ width: 30px;
515
+ height: 30px;
516
+ bottom: -8px;
517
+ left: 3px;
518
+ background: url(../img/icon_mail.png) no-repeat;
519
+ position: absolute;
520
+ }
521
+
522
+ .form_input {
523
+ display: flex;
524
+ justify-content: center;
525
+ }
526
+
527
+ .form_input .username,
528
+ .form_input .mail {
529
+ margin: 0 20px;
530
+ }
531
+
532
+ .form_btn {
533
+ padding-top: 60px;
534
+ display: flex;
535
+ justify-content: center;
536
+ }
537
+
538
+ .form_create_btn,
539
+ .form_return_btn {
540
+ margin: 0 20px;
541
+ }
542
+
543
+ .form_create_btn:hover,
544
+ .form_return_btn:hover {
545
+ opacity: 0.7;
546
+ }
547
+
548
+ .form_create_btn:active,
549
+ .form_return_btn:active {
550
+ transform: scale(0.95);
551
+ }
552
+
553
+
554
+ /*return_btn*/
555
+
556
+ p.return {
557
+ position: relative;
558
+ background: #b0b4c2;
559
+ border-radius: 3px;
560
+ }
561
+
562
+ p.return a {
563
+ padding: 10px;
564
+ padding-left: 50px;
565
+ padding-right: 25px;
566
+ color: #0e1d44;
567
+ font-weight: bold;
568
+ display: block;
569
+ }
570
+
571
+ p.return a:before {
572
+ content: "";
573
+ width: 30px;
574
+ height: 25px;
575
+ background-image: url(../img/arrow_return.png);
576
+ top: 55%;
577
+ left: 10%;
578
+ transform: translate(0, -55%);
579
+ position: absolute;
580
+ }
581
+
582
+
583
+ /*create_btn*/
584
+
585
+ .form_create_btn input {
586
+ border: none;
587
+ padding: 10px 68px;
588
+ background-color: #e2563b;
589
+ color: #fff;
590
+ }
591
+
592
+
593
+ .var_dump {
594
+
595
+ padding: 15px;
596
+
597
+ background: #cef;
598
+
599
+ font-size: 16px;
600
+
601
+ }
602
+
603
+
604
+
40
605
  ```
41
606
 
42
607
  ### 試したこと