回答編集履歴
5
修正
test
CHANGED
@@ -471,3 +471,9 @@
|
|
471
471
|
</html>
|
472
472
|
|
473
473
|
```
|
474
|
+
|
475
|
+
|
476
|
+
|
477
|
+
よくみたら、HTMLも文法かなり無視したオレオレルールで書いてますね…
|
478
|
+
|
479
|
+
type 属性に存在しないものを書いているし、label for とコントロールが一致してないし。
|
4
修正
test
CHANGED
@@ -254,6 +254,12 @@
|
|
254
254
|
|
255
255
|
$stmt->execute();
|
256
256
|
|
257
|
+
|
258
|
+
|
259
|
+
// セッションに保存
|
260
|
+
|
261
|
+
$_SESSION = filter_input_array(INPUT_POST);
|
262
|
+
|
257
263
|
}
|
258
264
|
|
259
265
|
}
|
3
追記
test
CHANGED
@@ -22,6 +22,10 @@
|
|
22
22
|
|
23
23
|
|
24
24
|
|
25
|
+
例えば、 何を意味するプリフィックスかは知りませんが、`mssa-` と `Mssa-` 使い分けに意味がないなら統一すべきでしょう。
|
26
|
+
|
27
|
+
|
28
|
+
|
25
29
|
---
|
26
30
|
|
27
31
|
|
2
追記
test
CHANGED
@@ -19,3 +19,445 @@
|
|
19
19
|
|
20
20
|
|
21
21
|
あと変数名などの命名に規則性がなく、とても作業に **雑さ** が目立ちます。無駄にミスを誘引するので気をつけましょう。
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
---
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
```php
|
30
|
+
|
31
|
+
<?php
|
32
|
+
|
33
|
+
ini_set('display_errors', 1);
|
34
|
+
|
35
|
+
error_reporting(E_ALL);
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
$dsn = 'mysql:dbname=mfdb;host=localhost';
|
40
|
+
|
41
|
+
$user = 'root';
|
42
|
+
|
43
|
+
$password = '';
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
try {
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
if (filter_input_array(INPUT_POST)) {
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
$companyoffice = filter_input(INPUT_POST, 'companyoffice');
|
56
|
+
|
57
|
+
$cmpNum1 = filter_input(INPUT_POST, 'cmpNum1');
|
58
|
+
|
59
|
+
$cmpname1 = filter_input(INPUT_POST, 'cmpname1');
|
60
|
+
|
61
|
+
$cmpname2 = filter_input(INPUT_POST, 'cmpname2');
|
62
|
+
|
63
|
+
$mssa1 = filter_input(INPUT_POST, 'mssa1');
|
64
|
+
|
65
|
+
$mssa2 = filter_input(INPUT_POST, 'mssa2');
|
66
|
+
|
67
|
+
$mssapass = filter_input(INPUT_POST, 'mssapass');
|
68
|
+
|
69
|
+
$mssaemail = filter_input(INPUT_POST, 'mssaemail');
|
70
|
+
|
71
|
+
$mssatel1 = filter_input(INPUT_POST, 'mssatel1');
|
72
|
+
|
73
|
+
$mssafax1 = filter_input(INPUT_POST, 'mssafax1');
|
74
|
+
|
75
|
+
$mssazip = filter_input(INPUT_POST, 'mssazip');
|
76
|
+
|
77
|
+
$mssaprefecture = filter_input(INPUT_POST, 'mssaprefecture');
|
78
|
+
|
79
|
+
$MssaAddress = filter_input(INPUT_POST, 'MssaAddress');
|
80
|
+
|
81
|
+
$Mssabill = filter_input(INPUT_POST, 'Mssabill');
|
82
|
+
|
83
|
+
$sjs = filter_input(INPUT_POST, 'sjs');
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
$err = array();
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
if (empty($companyoffice)) {
|
92
|
+
|
93
|
+
$err['companyoffice'] = "事業者及びその事業所を入力してください";
|
94
|
+
|
95
|
+
}
|
96
|
+
|
97
|
+
if (empty($cmpNum1)) {
|
98
|
+
|
99
|
+
$err['cmpNum1'] = "事業者代表名(フリガナ)を入力してください";
|
100
|
+
|
101
|
+
}
|
102
|
+
|
103
|
+
if (empty($cmpname1)) {
|
104
|
+
|
105
|
+
$err['cmpname1'] = "事業者代表名を入力してください";
|
106
|
+
|
107
|
+
}
|
108
|
+
|
109
|
+
if (empty($cmpname2)) {
|
110
|
+
|
111
|
+
$err['cmpname2'] = "事業者代表名(フリガナ)を入力してください";
|
112
|
+
|
113
|
+
}
|
114
|
+
|
115
|
+
if (empty($mssa1)) {
|
116
|
+
|
117
|
+
$err['mssa1'] = "本店システム管理者を入力してください";
|
118
|
+
|
119
|
+
}
|
120
|
+
|
121
|
+
if (empty($mssa2)) {
|
122
|
+
|
123
|
+
$err['mssa2'] = "本店システム管理者(フリガナ)を入力してください";
|
124
|
+
|
125
|
+
}
|
126
|
+
|
127
|
+
if (empty($mssapass)) {
|
128
|
+
|
129
|
+
$err['mssapass'] = "本店管理者用パスワードを入力してください";
|
130
|
+
|
131
|
+
}
|
132
|
+
|
133
|
+
if (empty($mssaemail)) {
|
134
|
+
|
135
|
+
$err['mssaemail'] = "本店メールアドレスを入力してください";
|
136
|
+
|
137
|
+
}
|
138
|
+
|
139
|
+
if (empty($mssatel1)) {
|
140
|
+
|
141
|
+
$err['mssatel1'] = "本店電話番号の左を入力してください";
|
142
|
+
|
143
|
+
}
|
144
|
+
|
145
|
+
if (empty($mssafax1)) {
|
146
|
+
|
147
|
+
$err['mssafax1'] = "本店FAX番号の左を入力してください";
|
148
|
+
|
149
|
+
}
|
150
|
+
|
151
|
+
if (empty($mssazip)) {
|
152
|
+
|
153
|
+
$err['mssazip'] = "本店郵便番号を入力してください";
|
154
|
+
|
155
|
+
}
|
156
|
+
|
157
|
+
if (empty($mssaprefecture)) {
|
158
|
+
|
159
|
+
$err['mssaprefecture'] = "本店都道府県を入力してください";
|
160
|
+
|
161
|
+
}
|
162
|
+
|
163
|
+
if (empty($MssaAddress)) {
|
164
|
+
|
165
|
+
$err['MssaAddress'] = "本店住所を入力してください";
|
166
|
+
|
167
|
+
}
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
// どこで使うおつもり?
|
172
|
+
|
173
|
+
if (empty($Mssabill)) {
|
174
|
+
|
175
|
+
$err['Mssabill'] = "本店所在ビルを入力してください";
|
176
|
+
|
177
|
+
}
|
178
|
+
|
179
|
+
if (empty($sjs)) {
|
180
|
+
|
181
|
+
$err['sjs'] = "就労支援種目を入力してください";
|
182
|
+
|
183
|
+
}
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
// エラーの数を数えて、エラーがなければインサート
|
188
|
+
|
189
|
+
if (0 == count($err)) {
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
$db = new PDO($dsn, $user, $password
|
194
|
+
|
195
|
+
, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
|
196
|
+
|
197
|
+
);
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
$sql = "INSERT INTO office (";
|
202
|
+
|
203
|
+
$sql .= "companyoffice, cmpNum1, cmpname1, cmpname2, mssa1, mssa2, mssapass, mssaemail, mssatel1, mssafax1, mssazip, mssaprefecture, MssaAddress, sjs";
|
204
|
+
|
205
|
+
$sql .= ") VALUES (";
|
206
|
+
|
207
|
+
$sql .= ":companyoffice,:cmpNum1,:cmpname1,:cmpname2,:mssa1,:mssa2,:mssapass,:mssaemail,:mssatel1,:mssafax1,:mssazip,:mssaprefecture,:MssaAddress,:sjs";
|
208
|
+
|
209
|
+
$sql .= ")";
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
$stmt = $db->prepare($sql);
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
// パラメータのセットの仕方はマニュアルで確認してください。
|
218
|
+
|
219
|
+
$stmt->bindParam(':companyoffice', $companyoffice, PDO::PARAM_STR);
|
220
|
+
|
221
|
+
$stmt->bindParam(':cmpNum1', $cmpNum1, PDO::PARAM_INT);
|
222
|
+
|
223
|
+
$stmt->bindParam(':cmpname1', $cmpname1, PDO::PARAM_STR);
|
224
|
+
|
225
|
+
$stmt->bindParam(':cmpname2', $cmpname2, PDO::PARAM_STR);
|
226
|
+
|
227
|
+
$stmt->bindParam(':mssa1', $mssa1, PDO::PARAM_STR);
|
228
|
+
|
229
|
+
$stmt->bindParam(':mssa2', $mssa2, PDO::PARAM_STR);
|
230
|
+
|
231
|
+
$stmt->bindParam(':mssapass', $mssapass, PDO::PARAM_STR);
|
232
|
+
|
233
|
+
$stmt->bindParam(':mssaemail', $mssaemail, PDO::PARAM_STR);
|
234
|
+
|
235
|
+
$stmt->bindParam(':mssatel1', $mssatel1, PDO::PARAM_STR);
|
236
|
+
|
237
|
+
$stmt->bindParam(':mssafax1', $mssafax1, PDO::PARAM_STR);
|
238
|
+
|
239
|
+
$stmt->bindParam(':mssazip', $mssazip, PDO::PARAM_STR);
|
240
|
+
|
241
|
+
$stmt->bindParam(':mssaprefecture', $mssaprefecture, PDO::PARAM_STR);
|
242
|
+
|
243
|
+
$stmt->bindParam(':MssaAddress', $MssaAddress, PDO::PARAM_STR);
|
244
|
+
|
245
|
+
$stmt->bindParam(':sjs', $sjs, PDO::PARAM_STR);
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
// 実行
|
250
|
+
|
251
|
+
$stmt->execute();
|
252
|
+
|
253
|
+
}
|
254
|
+
|
255
|
+
}
|
256
|
+
|
257
|
+
} catch (PDOException $e) {
|
258
|
+
|
259
|
+
$err['all'] = $e->getMessage();
|
260
|
+
|
261
|
+
}
|
262
|
+
|
263
|
+
?>
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
<!DOCTYPE HTML>
|
268
|
+
|
269
|
+
<html lang="ja">
|
270
|
+
|
271
|
+
<head>
|
272
|
+
|
273
|
+
<meta charset="UTF-8">
|
274
|
+
|
275
|
+
<title></title>
|
276
|
+
|
277
|
+
</head>
|
278
|
+
|
279
|
+
<body>
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
<?php if (isset($err) && 0 < count($err)) : ?>
|
284
|
+
|
285
|
+
<p>
|
286
|
+
|
287
|
+
<?= nl2br(implode(PHP_EOL, $err)); ?>
|
288
|
+
|
289
|
+
</p>
|
290
|
+
|
291
|
+
<?php endif; ?>
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
<form method="post" action="" class="contact">
|
296
|
+
|
297
|
+
<table>
|
298
|
+
|
299
|
+
<caption>事業者登録票</caption>
|
300
|
+
|
301
|
+
<tbody>
|
302
|
+
|
303
|
+
<tr>
|
304
|
+
|
305
|
+
<th><label for="section">事業者及びその事業所</label></th>
|
306
|
+
|
307
|
+
<td class="required" ><img src="./img/required1.gif" alt="必須" width="26" height="15"></td>
|
308
|
+
|
309
|
+
<td colspan="10"><input type="text" name="companyoffice" value=""></td>
|
310
|
+
|
311
|
+
</tr>
|
312
|
+
|
313
|
+
<tr>
|
314
|
+
|
315
|
+
<th><label for="section">事業者番号 </label></th>
|
316
|
+
|
317
|
+
<td class="required" ><img src="./img/required1.gif" alt="必須" width="26" height="15"></td>
|
318
|
+
|
319
|
+
<td><input type="number" name="cmpNum1" size="10" maxlength="30" value=""></td>
|
320
|
+
|
321
|
+
</tr>
|
322
|
+
|
323
|
+
<tr>
|
324
|
+
|
325
|
+
<th><label for="section">事業者代表名</label></th>
|
326
|
+
|
327
|
+
<td class="required" ><img src="./img/required1.gif" alt="必須" width="26" height="15"></td>
|
328
|
+
|
329
|
+
<td colspan="10"><input type="text" name="cmpname1" size="10" maxlength="30" value=""></td>
|
330
|
+
|
331
|
+
</tr>
|
332
|
+
|
333
|
+
<tr>
|
334
|
+
|
335
|
+
<th><label for="section">事業者代表名 <span class="supplement">(フリガナ)</span></label></th>
|
336
|
+
|
337
|
+
<td class="required"><img src="./img/required1.gif" alt="必須" width="26" height="15"></td>
|
338
|
+
|
339
|
+
<td colspan="10"><input type="text" name="cmpname2" size="10" maxlength="30" value=""></td>
|
340
|
+
|
341
|
+
</tr>
|
342
|
+
|
343
|
+
<tr>
|
344
|
+
|
345
|
+
<th><label for="section">本店システム管理者</label></th>
|
346
|
+
|
347
|
+
<td class="required" ><img src="./img/required1.gif" alt="必須" width="26" height="15"></td>
|
348
|
+
|
349
|
+
<td colspan="10"><input type="text" name="mssa1" size="10" maxlength="30" value=""></td>
|
350
|
+
|
351
|
+
</tr>
|
352
|
+
|
353
|
+
<tr>
|
354
|
+
|
355
|
+
<th><label for="section">本店システム管理者<br><span class="supplement">(フリガナ)</span></label></th>
|
356
|
+
|
357
|
+
<td class="required"><img src="./img/required1.gif" alt="必須" width="26" height="15"></td>
|
358
|
+
|
359
|
+
<td colspan="10"><input type="text" name="mssa2" size="10" maxlength="30" value=""></td>
|
360
|
+
|
361
|
+
</tr>
|
362
|
+
|
363
|
+
<tr>
|
364
|
+
|
365
|
+
<th><label for="email">本店管理者用<br>パスワード</label></th>
|
366
|
+
|
367
|
+
<td class="required"><img src="./img/required1.gif" alt="必須" width="26" height="15"></td>
|
368
|
+
|
369
|
+
<td colspan="10"><input type="password" name="mssapass" size="30" maxlength="30"><br>
|
370
|
+
|
371
|
+
<span class="supplement">ご入力間違いのないようにご注意ください</span></td>
|
372
|
+
|
373
|
+
</tr>
|
374
|
+
|
375
|
+
<tr>
|
376
|
+
|
377
|
+
<th><label for="email">本店メールアドレス</label></th>
|
378
|
+
|
379
|
+
<td class="required"><img src="./img/required1.gif" alt="必須" width="26" height="15"></td>
|
380
|
+
|
381
|
+
<td colspan="10"><input type="email" name="mssaemail" size="30" maxlength="50"><br>
|
382
|
+
|
383
|
+
<span class="supplement">ご入力間違いのないようにご注意ください</span></td>
|
384
|
+
|
385
|
+
</tr>
|
386
|
+
|
387
|
+
<tr>
|
388
|
+
|
389
|
+
<th><label for="tel1">本店電話番号</label></th>
|
390
|
+
|
391
|
+
<td class="required" ><img src="./img/required1.gif" alt="必須" width="26" height="15"></td>
|
392
|
+
|
393
|
+
<td colspan="10"><input type="tel" name="mssatel1" size="15" maxlength="15"></td>
|
394
|
+
|
395
|
+
</tr>
|
396
|
+
|
397
|
+
<tr>
|
398
|
+
|
399
|
+
<th><label for="fax1">本店FAX番号</label></th>
|
400
|
+
|
401
|
+
<td class="required" ><img src="./img/required1.gif" alt="必須" width="26" height="15"></td>
|
402
|
+
|
403
|
+
<td colspan="10"><input type="text" name="mssafax1" size="15" maxlength="15"></td>
|
404
|
+
|
405
|
+
</tr>
|
406
|
+
|
407
|
+
<tr>
|
408
|
+
|
409
|
+
<th rowspan="3"><label for="zip1">本店住所</label></th>
|
410
|
+
|
411
|
+
<td class="required" ><img src="./img/required1.gif" alt="必須" width="26" height="15"></td>
|
412
|
+
|
413
|
+
<td colspan="10"><label for="zip1">〒</label>
|
414
|
+
|
415
|
+
<input type="number" name="mssazip" size="5" maxlength="10" value=""></td>
|
416
|
+
|
417
|
+
</tr>
|
418
|
+
|
419
|
+
<tr>
|
420
|
+
|
421
|
+
<td class="required"><img src="./img/required1.gif" alt="必須" width="26" height="15"></td>
|
422
|
+
|
423
|
+
<td colspan="10"><input type="address" name="mssaprefecture" size="40" maxlength="20"></td>
|
424
|
+
|
425
|
+
</tr>
|
426
|
+
|
427
|
+
<tr>
|
428
|
+
|
429
|
+
<td class="required" ><img src="./img/required1.gif" alt="必須" width="26" height="15"></td>
|
430
|
+
|
431
|
+
<td colspan="10"><input type="address" name="MssaAddress" size="40" maxlength="20"></td>
|
432
|
+
|
433
|
+
</tr>
|
434
|
+
|
435
|
+
<tr>
|
436
|
+
|
437
|
+
<th><label for="company">就労支援種目</label></th>
|
438
|
+
|
439
|
+
<td class="required" ><img src="./img/required1.gif" alt="必須" width="26" height="15"></td>
|
440
|
+
|
441
|
+
<td colspan="10"><input type="checkbox" name="sjs" value="A:雇用型" checked>A:雇用型
|
442
|
+
|
443
|
+
<input type="checkbox" name="sjs" value="B:非雇用型">B:非雇用型
|
444
|
+
|
445
|
+
<input type="checkbox" name="sjs" value="C:就労移行支援">C:就労移行支援</td>
|
446
|
+
|
447
|
+
</tr>
|
448
|
+
|
449
|
+
<tr>
|
450
|
+
|
451
|
+
</table>
|
452
|
+
|
453
|
+
<a href="company.php?action=rewrite">« 書き直す</a>
|
454
|
+
|
455
|
+
<p class="button"><input type="submit" value="登録"></p>
|
456
|
+
|
457
|
+
</form>
|
458
|
+
|
459
|
+
</body>
|
460
|
+
|
461
|
+
</html>
|
462
|
+
|
463
|
+
```
|
1
修正
test
CHANGED
@@ -11,3 +11,11 @@
|
|
11
11
|
あと、execute した後で、入力値をチェックしても意味がありません。
|
12
12
|
|
13
13
|
プログラムは上から順番に実行されます。
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
---
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
あと変数名などの命名に規則性がなく、とても作業に **雑さ** が目立ちます。無駄にミスを誘引するので気をつけましょう。
|