質問編集履歴
4
改善後のコードを記載しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -147,3 +147,115 @@
|
|
147
147
|
}
|
148
148
|
|
149
149
|
```
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
★2/28追記
|
154
|
+
|
155
|
+
以下に変更したところ、改善しました。
|
156
|
+
|
157
|
+
(ほぼFuelPHPクラスは使っておりませんが。)
|
158
|
+
|
159
|
+
しかし、なぜ改善したのかは現在調査中です。
|
160
|
+
|
161
|
+
もしご存知の方がいらっしゃいましたら、ご教授をお願い致します。
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
問題点
|
166
|
+
|
167
|
+
・POST送信した際、英小文字が「abjqvwxy」しか送信できない。
|
168
|
+
|
169
|
+
(日本語、数字は問題なし)
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
改善点
|
174
|
+
|
175
|
+
・$_POSTではなく、$_REQUESTにしたら、英小文字も問題なく受信できた。
|
176
|
+
|
177
|
+
(なぜRIQUESTで受信したら、英小文字までカバーできたのか?)
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
views/index.php
|
184
|
+
|
185
|
+
```lang-php
|
186
|
+
|
187
|
+
<form action="confirm" method="post">
|
188
|
+
|
189
|
+
<input type="text" name="name" />
|
190
|
+
|
191
|
+
<input type="text" name="address" />
|
192
|
+
|
193
|
+
<input type="text" name="password" />
|
194
|
+
|
195
|
+
<input type="submit" value="登録する" />
|
196
|
+
|
197
|
+
</form>
|
198
|
+
|
199
|
+
```
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
views/confirm.php
|
204
|
+
|
205
|
+
```lang-php
|
206
|
+
|
207
|
+
<h2>こちらで登録してよろしいですか?</h2>
|
208
|
+
|
209
|
+
<?php $name = $_REQUEST['name']; ?>
|
210
|
+
|
211
|
+
<?php $address = $_REQUEST['address']; ?>
|
212
|
+
|
213
|
+
<?php $password = $_REQUEST['password']; ?>
|
214
|
+
|
215
|
+
<p>名前:<?php echo $name; ?></p>
|
216
|
+
|
217
|
+
<p>住所:<?php echo $address; ?></p>
|
218
|
+
|
219
|
+
<p>パスワード:<?php echo $password; ?></p>
|
220
|
+
|
221
|
+
```
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
controller/add.php
|
226
|
+
|
227
|
+
```lang-php
|
228
|
+
|
229
|
+
<?php class Controller_Add_Add extends Controller_Template {
|
230
|
+
|
231
|
+
public function action_index() {
|
232
|
+
|
233
|
+
$this->template->title = '会員登録';
|
234
|
+
|
235
|
+
$this->template->content = View::forge('index');
|
236
|
+
|
237
|
+
}
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
public function action_confirm() {
|
242
|
+
|
243
|
+
$this->template->title = '登録内容確認';
|
244
|
+
|
245
|
+
$this->template->content = View::forge('confirm', $data);
|
246
|
+
|
247
|
+
} else {
|
248
|
+
|
249
|
+
$this->template->title = 'エラー';
|
250
|
+
|
251
|
+
$this->template->content = View::forge('index');
|
252
|
+
|
253
|
+
$this->template->content->set_safe('html_error',$val->show_errors());
|
254
|
+
|
255
|
+
}
|
256
|
+
|
257
|
+
}
|
258
|
+
|
259
|
+
}
|
260
|
+
|
261
|
+
```
|
3
コード部分を修正しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -36,6 +36,8 @@
|
|
36
36
|
|
37
37
|
views/index.php
|
38
38
|
|
39
|
+
```lang-php
|
40
|
+
|
39
41
|
<?php echo Form::open('confirm'); ?>
|
40
42
|
|
41
43
|
|
@@ -46,7 +48,7 @@
|
|
46
48
|
|
47
49
|
|
48
50
|
|
49
|
-
<?php echo Form::label('
|
51
|
+
<?php echo Form::label('住所', 'address'); ?>:
|
50
52
|
|
51
53
|
<?php echo Form::input('address', Input::post('address')); ?><br />
|
52
54
|
|
@@ -62,7 +64,7 @@
|
|
62
64
|
|
63
65
|
<?php echo Form::close(); ?>
|
64
66
|
|
65
|
-
|
67
|
+
```
|
66
68
|
|
67
69
|
|
68
70
|
|
@@ -72,17 +74,21 @@
|
|
72
74
|
|
73
75
|
|
74
76
|
|
77
|
+
```lang-php
|
78
|
+
|
75
79
|
<p>名前:<?php echo $input['name']; ?></p>
|
76
80
|
|
77
|
-
<p>ユーザーネーム:<?php echo $input['
|
81
|
+
<p>ユーザーネーム:<?php echo $input['address']; ?></p>
|
78
82
|
|
79
83
|
<p>パスワード:<?php echo $input['password']; ?></p>
|
80
84
|
|
85
|
+
```
|
81
86
|
|
82
87
|
|
83
88
|
|
89
|
+
controller/add.php
|
84
90
|
|
85
|
-
|
91
|
+
```lang-php
|
86
92
|
|
87
93
|
<?php class Controller_Add_Add extends Controller_Template {
|
88
94
|
|
@@ -130,7 +136,7 @@
|
|
130
136
|
|
131
137
|
$val->add('name','名前');
|
132
138
|
|
133
|
-
$val->add('
|
139
|
+
$val->add('address','住所');
|
134
140
|
|
135
141
|
$val->add('password','パスワード');
|
136
142
|
|
@@ -139,3 +145,5 @@
|
|
139
145
|
}
|
140
146
|
|
141
147
|
}
|
148
|
+
|
149
|
+
```
|
2
コードを記載致します。
test
CHANGED
File without changes
|
test
CHANGED
@@ -38,17 +38,25 @@
|
|
38
38
|
|
39
39
|
<?php echo Form::open('confirm'); ?>
|
40
40
|
|
41
|
+
|
42
|
+
|
41
43
|
<?php echo Form::label('名前', 'name'); ?>:
|
42
44
|
|
43
|
-
<?php echo Form::input('name', Input::post('name')); ?><br />
|
45
|
+
<?php echo Form::input('name', Input::post('name')); ?><br />
|
46
|
+
|
47
|
+
|
44
48
|
|
45
49
|
<?php echo Form::label('ニックネーム', 'address'); ?>:
|
46
50
|
|
47
51
|
<?php echo Form::input('address', Input::post('address')); ?><br />
|
48
52
|
|
53
|
+
|
54
|
+
|
49
55
|
<?php echo Form::label('パスワード', 'password'); ?>:
|
50
56
|
|
51
57
|
<?php echo Form::input('password', Input::post('パスワード')); ?><br />
|
58
|
+
|
59
|
+
|
52
60
|
|
53
61
|
<?php echo Form::submit('submit', '登録する'); ?>
|
54
62
|
|
@@ -56,13 +64,13 @@
|
|
56
64
|
|
57
65
|
|
58
66
|
|
67
|
+
|
68
|
+
|
59
69
|
views/confirm.php
|
60
70
|
|
61
|
-
<h2>こちらで登録してよろしいですか?</h2>
|
71
|
+
<h2>こちらで登録してよろしいですか?</h2>
|
62
72
|
|
63
|
-
<?php //echo $_POST['address']; ?>
|
64
73
|
|
65
|
-
<?php var_dump($input); ?>
|
66
74
|
|
67
75
|
<p>名前:<?php echo $input['name']; ?></p>
|
68
76
|
|
@@ -72,52 +80,62 @@
|
|
72
80
|
|
73
81
|
|
74
82
|
|
83
|
+
|
84
|
+
|
75
85
|
controller/add.php
|
76
86
|
|
77
87
|
<?php class Controller_Add_Add extends Controller_Template {
|
78
88
|
|
79
|
-
public function action_index() {
|
89
|
+
public function action_index() {
|
80
90
|
|
81
|
-
$this->template->title = '会員登録';
|
91
|
+
$this->template->title = '会員登録';
|
82
92
|
|
83
|
-
$this->template->content = View::forge('index');
|
93
|
+
$this->template->content = View::forge('index');
|
84
94
|
|
85
|
-
}
|
95
|
+
}
|
86
96
|
|
87
|
-
public function action_confirm() {
|
88
97
|
|
89
|
-
$val = $this->forge_validation();
|
90
98
|
|
91
|
-
if
|
99
|
+
public function action_confirm() {
|
92
100
|
|
93
|
-
$
|
101
|
+
$val = $this->forge_validation();
|
94
102
|
|
95
|
-
$
|
103
|
+
if($val->run()) {
|
96
104
|
|
97
|
-
$t
|
105
|
+
$data['input'] = $val->validated();
|
98
106
|
|
99
|
-
|
107
|
+
$this->template->title = '登録内容確認';
|
100
108
|
|
101
|
-
$this->template->t
|
109
|
+
$this->template->content = View::forge('confirm', $data);
|
102
110
|
|
103
|
-
|
111
|
+
} else {
|
104
112
|
|
105
|
-
$this->template->
|
113
|
+
$this->template->title = 'エラー';
|
106
114
|
|
107
|
-
|
115
|
+
$this->template->content = View::forge('index');
|
108
116
|
|
109
|
-
|
117
|
+
$this->template->content->set_safe('html_error',$val->show_errors());
|
110
118
|
|
111
|
-
|
119
|
+
}
|
112
120
|
|
113
|
-
|
121
|
+
}
|
114
122
|
|
115
|
-
$val->add('name','名前');
|
116
123
|
|
117
|
-
$val->add('nickname','ニックネーム');
|
118
124
|
|
119
|
-
|
125
|
+
public function forge_validation() {
|
120
126
|
|
121
|
-
|
127
|
+
$val = Validation::forge();
|
122
128
|
|
129
|
+
|
130
|
+
|
131
|
+
$val->add('name','名前');
|
132
|
+
|
133
|
+
$val->add('nickname','ニックネーム');
|
134
|
+
|
135
|
+
$val->add('password','パスワード');
|
136
|
+
|
137
|
+
return $val;
|
138
|
+
|
123
|
-
}
|
139
|
+
}
|
140
|
+
|
141
|
+
}
|
1
コードを追記致します。
test
CHANGED
File without changes
|
test
CHANGED
@@ -29,3 +29,95 @@
|
|
29
29
|
|
30
30
|
|
31
31
|
ご存知の方いらっしゃいましたら、ご教授の程、宜しくお願い致します。
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
★追記
|
36
|
+
|
37
|
+
views/index.php
|
38
|
+
|
39
|
+
<?php echo Form::open('confirm'); ?>
|
40
|
+
|
41
|
+
<?php echo Form::label('名前', 'name'); ?>:
|
42
|
+
|
43
|
+
<?php echo Form::input('name', Input::post('name')); ?><br />
|
44
|
+
|
45
|
+
<?php echo Form::label('ニックネーム', 'address'); ?>:
|
46
|
+
|
47
|
+
<?php echo Form::input('address', Input::post('address')); ?><br />
|
48
|
+
|
49
|
+
<?php echo Form::label('パスワード', 'password'); ?>:
|
50
|
+
|
51
|
+
<?php echo Form::input('password', Input::post('パスワード')); ?><br />
|
52
|
+
|
53
|
+
<?php echo Form::submit('submit', '登録する'); ?>
|
54
|
+
|
55
|
+
<?php echo Form::close(); ?>
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
views/confirm.php
|
60
|
+
|
61
|
+
<h2>こちらで登録してよろしいですか?</h2>
|
62
|
+
|
63
|
+
<?php //echo $_POST['address']; ?>
|
64
|
+
|
65
|
+
<?php var_dump($input); ?>
|
66
|
+
|
67
|
+
<p>名前:<?php echo $input['name']; ?></p>
|
68
|
+
|
69
|
+
<p>ユーザーネーム:<?php echo $input['nickname']; ?></p>
|
70
|
+
|
71
|
+
<p>パスワード:<?php echo $input['password']; ?></p>
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
controller/add.php
|
76
|
+
|
77
|
+
<?php class Controller_Add_Add extends Controller_Template {
|
78
|
+
|
79
|
+
public function action_index() {
|
80
|
+
|
81
|
+
$this->template->title = '会員登録';
|
82
|
+
|
83
|
+
$this->template->content = View::forge('index');
|
84
|
+
|
85
|
+
}
|
86
|
+
|
87
|
+
public function action_confirm() {
|
88
|
+
|
89
|
+
$val = $this->forge_validation();
|
90
|
+
|
91
|
+
if($val->run()) {
|
92
|
+
|
93
|
+
$data['input'] = $val->validated();
|
94
|
+
|
95
|
+
$this->template->title = '登録内容確認';
|
96
|
+
|
97
|
+
$this->template->content = View::forge('confirm', $data);
|
98
|
+
|
99
|
+
} else {
|
100
|
+
|
101
|
+
$this->template->title = 'コンタクトフォーム: エラー';
|
102
|
+
|
103
|
+
$this->template->content = View::forge('index');
|
104
|
+
|
105
|
+
$this->template->content->set_safe('html_error',$val->show_errors());
|
106
|
+
|
107
|
+
}
|
108
|
+
|
109
|
+
}
|
110
|
+
|
111
|
+
public function forge_validation() {
|
112
|
+
|
113
|
+
$val = Validation::forge();
|
114
|
+
|
115
|
+
$val->add('name','名前');
|
116
|
+
|
117
|
+
$val->add('nickname','ニックネーム');
|
118
|
+
|
119
|
+
$val->add('password','パスワード'); return $val;
|
120
|
+
|
121
|
+
}
|
122
|
+
|
123
|
+
}
|