回答編集履歴

1

sample

2018/04/06 05:11

投稿

yambejp
yambejp

スコア114843

test CHANGED
@@ -1,3 +1,53 @@
1
1
  値を引き継ぎたいならinputのvalueは必ずエスケープ(htmlspecialchars)して
2
2
 
3
3
  クォーテーションでくくってください
4
+
5
+
6
+
7
+
8
+
9
+ # sample
10
+
11
+
12
+
13
+ ```PHP
14
+
15
+ $email = filter_input(INPUT_POST,'email');
16
+
17
+ $password = filter_input(INPUT_POST,'password');
18
+
19
+ $password_check = filter_input(INPUT_POST,'password_check');
20
+
21
+ $name = filter_input(INPUT_POST,'name');
22
+
23
+ $h=[];
24
+
25
+ foreach(["email","password","password_check","name"] as $val){
26
+
27
+ $h[$val]=htmlspecialchars($$val);
28
+
29
+ };
30
+
31
+
32
+
33
+ print<<<eof
34
+
35
+ <form method="post">
36
+
37
+ email:<input type="text" name="email" value="{$h["email"]}"><br>
38
+
39
+ password:<input type="text" name="password" value="{$h["password"]}"><br>
40
+
41
+ password_check:<input type="text" name="password_check" value="{$h["password_check"]}"><br>
42
+
43
+ name:<input type="text" name="name" value="{$h["name"]}"><br>
44
+
45
+ <input type="submit" value="go">
46
+
47
+ </form>
48
+
49
+ eof;
50
+
51
+
52
+
53
+ ```