質問編集履歴

1

staff_add_check.phpを追加しました

2020/01/19 11:39

投稿

aka88533383
aka88533383

スコア10

title CHANGED
File without changes
body CHANGED
@@ -1,6 +1,6 @@
1
1
  chromeでhttp://localhost/staff/staff_add.phpを検索するとしっかりフォームが表示されますが、
2
2
 
3
-
3
+ staff_add.php↓
4
4
  ```html
5
5
  <html>
6
6
  <head>
@@ -24,6 +24,56 @@
24
24
  </body>
25
25
  </html>
26
26
  ```
27
+ staff_add_check.php↓
28
+ ```html
29
+ <!DOCTYPE html>
30
+ <html>
31
+ <head>
32
+ <meta charset="UTF=8">
33
+ <title>タイトル</title>
34
+ </head>
35
+ <body>
36
+ <?php
37
+ $staff_name=$_POST['name'];
38
+ $staff_pass=$_POST['pass'];
39
+ $staff_pass2=$_POST['pass2'];
40
+
41
+ $staff_name= htmlspecialchars($staff_name,ENT_QUOTES,'UTF-8');
42
+ $staff_pass= htmlspecialchars($staff_pass,ENT_QUOTES,'UTF-8');
43
+ $staff_pass2= htmlspecialchars($staff_pass2,ENT_QUOTES,'UTF-8');
44
+
45
+ if($staff_name==''){
46
+ print'スタッフ名が入力されていません。</br>';
47
+ } else {
48
+ print 'スタッフ名:';
49
+ print $staff_name;
50
+ print '<br/>';
51
+ }
52
+
53
+ if($staff_pass==''){
54
+ print'パスワードが入力されていません。<br />';
55
+ }
56
+
57
+ if($staff_pass!==$staff_pass2){
58
+ print'パスワードが一致しません。<br />';
59
+ }
60
+
61
+ if($staff_name==''||$staff_pass==''||$staff_pass!==$staff_pass2){
62
+ print'<from>';
63
+ print'<input type="button" onclick="history.back()" value="戻る">';
64
+ } else {
65
+ $staff_pass=md5($staff_pass);
66
+ print'<from method="post" axtion="staff_add_done.php">';
67
+ print'<input type="hidden" name="name" value="'.staff_name.'">';
68
+ print'<input type="hidden" name="pass" value="'.staff_pass.'">';
69
+ print<br />;
70
+ print'<input type="button" onclic="history.back()" value="戻る">';
71
+ print'<input type="submit" value="OK">';
72
+ print'</from>';
73
+ ?>
74
+ </body>
75
+ </html>
76
+ ```
27
77
  okボタンを押すと次のエラーが出ます。
28
78
 
29
79
  ![エラー画面](94ded423a9c0c26d00ca46df9df4da11.png)