質問編集履歴
3
不要な部分を除去
test
CHANGED
File without changes
|
test
CHANGED
@@ -116,12 +116,6 @@
|
|
116
116
|
|
117
117
|
$post_array = $this->input->post();
|
118
118
|
|
119
|
-
//カテゴリー
|
120
|
-
|
121
|
-
$category_array = $this->category->Get_Parent_Category();
|
122
|
-
|
123
|
-
$data["category_str"] = $this->common->Create_Category_List($category_array);
|
124
|
-
|
125
119
|
//検証ルール
|
126
120
|
|
127
121
|
$this->form_validation->set_rules('email','メールアドレス',array('required','min_length[10]','max_length[128]','matches[email_conf]','callback_check_duplicate_email'));
|
2
登録内容の誤記
test
CHANGED
File without changes
|
test
CHANGED
@@ -124,9 +124,9 @@
|
|
124
124
|
|
125
125
|
//検証ルール
|
126
126
|
|
127
|
-
$this->form_validation->set_rules('email','メールアドレス',array('required','min_length[10]','max_length[128]','matches[email_
|
127
|
+
$this->form_validation->set_rules('email','メールアドレス',array('required','min_length[10]','max_length[128]','matches[email_conf]','callback_check_duplicate_email'));
|
128
128
|
|
129
|
-
$this->form_validation->set_rules('email_conf','メールアドレス(確認)',array('required','min_length[10]','max_length[128]'
|
129
|
+
$this->form_validation->set_rules('email_conf','メールアドレス(確認)',array('required','min_length[10]','max_length[128]'));
|
130
130
|
|
131
131
|
//入力チェック
|
132
132
|
|
1
該当部分のみを抜粋して再登録します
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Codeigniter3.Xでの入力チェックで
|
1
|
+
Codeigniter3.Xでメールアドレスの入力チェックができない
|
test
CHANGED
@@ -1,140 +1,14 @@
|
|
1
1
|
CodeIgniterで開発を行っています。
|
2
2
|
|
3
|
-
入力チェックでemail
|
3
|
+
入力チェックでemail がほかの項目と異なる挙動を示しています。
|
4
|
+
|
5
|
+
(下記はemailのみ抜粋)
|
4
6
|
|
5
7
|
```
|
6
8
|
|
7
9
|
<table class="table" id="tbl_member">
|
8
10
|
|
9
11
|
<tbody>
|
10
|
-
|
11
|
-
<tr>
|
12
|
-
|
13
|
-
<th>お名前<span class="aster">※</span></th>
|
14
|
-
|
15
|
-
<td><input type="text" name="name1" id="name1" /> <input type="text" name="name2" id="name2" /></td>
|
16
|
-
|
17
|
-
</tr>
|
18
|
-
|
19
|
-
<tr>
|
20
|
-
|
21
|
-
<th>フリガナ<span class="aster">※</span></th>
|
22
|
-
|
23
|
-
<td><input type="text" name="name_kana1" id="name_kana1" /> <input type="text" name="name_kana2" id="name_kana2" /></td>
|
24
|
-
|
25
|
-
</tr>
|
26
|
-
|
27
|
-
<tr>
|
28
|
-
|
29
|
-
<th>性別<span class="aster">※</span></th>
|
30
|
-
|
31
|
-
<td><input type="radio" name="sex" value="1" id="sex1" checked="checked" />男性<input type="radio" name="sex" value="2" id="sex2" />女性</td>
|
32
|
-
|
33
|
-
</tr>
|
34
|
-
|
35
|
-
<tr>
|
36
|
-
|
37
|
-
<th>郵便番号<span class="aster">※</span></th>
|
38
|
-
|
39
|
-
<td><input type="text" name="zip" id="zip" size="6" maxlength="7" /><input type="button" name="addr_search_member" id="addr_search_member" value="住所検索" class="modal_btn" /></td>
|
40
|
-
|
41
|
-
</tr>
|
42
|
-
|
43
|
-
<tr>
|
44
|
-
|
45
|
-
<th>都道府県<span class="aster">※</span></th>
|
46
|
-
|
47
|
-
<td>
|
48
|
-
|
49
|
-
<select name="prefecture" id="prefecture">
|
50
|
-
|
51
|
-
<option value ="01" selected="selected">北海道</option> <option value ="02">青森県</option>
|
52
|
-
|
53
|
-
(割愛します)
|
54
|
-
|
55
|
-
</select>
|
56
|
-
|
57
|
-
</td>
|
58
|
-
|
59
|
-
</tr>
|
60
|
-
|
61
|
-
<tr>
|
62
|
-
|
63
|
-
<th>市区町村名<span class="aster">※</span></th>
|
64
|
-
|
65
|
-
<td><input type="text" name="address1" id="address1" size="50" /></td>
|
66
|
-
|
67
|
-
</tr>
|
68
|
-
|
69
|
-
<tr>
|
70
|
-
|
71
|
-
<th>番地・建物名<span class="aster">※</span></th>
|
72
|
-
|
73
|
-
<td><input type="text" name="address2" id="address2" size="50" /></td>
|
74
|
-
|
75
|
-
</tr>
|
76
|
-
|
77
|
-
<tr>
|
78
|
-
|
79
|
-
<th>電話番号<span class="aster">※</span></th>
|
80
|
-
|
81
|
-
<td><input type="text" name="tel" id="tel" /></td>
|
82
|
-
|
83
|
-
</tr>
|
84
|
-
|
85
|
-
<tr>
|
86
|
-
|
87
|
-
<th>携帯電話番号</th>
|
88
|
-
|
89
|
-
<td><input type="text" name="mobtel" id="mobtel" /></td>
|
90
|
-
|
91
|
-
</tr>
|
92
|
-
|
93
|
-
<tr>
|
94
|
-
|
95
|
-
<th>生年月日<span class="aster">※</span></th>
|
96
|
-
|
97
|
-
<td>
|
98
|
-
|
99
|
-
<select name="birth_year" id="birth_year">
|
100
|
-
|
101
|
-
<option value ="1931">1931</option>
|
102
|
-
|
103
|
-
<option value ="1932">1932</option>
|
104
|
-
|
105
|
-
(割愛します)
|
106
|
-
|
107
|
-
</select>
|
108
|
-
|
109
|
-
年
|
110
|
-
|
111
|
-
<select name="birth_month" id="birth_month">
|
112
|
-
|
113
|
-
<option value ="1">1</option>
|
114
|
-
|
115
|
-
<option value ="2">2</option>
|
116
|
-
|
117
|
-
(割愛します)
|
118
|
-
|
119
|
-
</select>
|
120
|
-
|
121
|
-
月
|
122
|
-
|
123
|
-
<select name="birth_day" id="birth_day">
|
124
|
-
|
125
|
-
<option value ="1">1</option>
|
126
|
-
|
127
|
-
<option value ="2">2</option>
|
128
|
-
|
129
|
-
(割愛します)
|
130
|
-
|
131
|
-
</select>
|
132
|
-
|
133
|
-
日
|
134
|
-
|
135
|
-
</td>
|
136
|
-
|
137
|
-
</tr>
|
138
12
|
|
139
13
|
<tr>
|
140
14
|
|
@@ -152,30 +26,6 @@
|
|
152
26
|
|
153
27
|
</tr>
|
154
28
|
|
155
|
-
<tr>
|
156
|
-
|
157
|
-
<th>パスワード<span class="aster">※</span></th>
|
158
|
-
|
159
|
-
<td><input type="password" name="password" id="password" /></td>
|
160
|
-
|
161
|
-
</tr>
|
162
|
-
|
163
|
-
<tr>
|
164
|
-
|
165
|
-
<th>パスワード(確認)<span class="aster">※</span></th>
|
166
|
-
|
167
|
-
<td><input type="password" name="password_conf" id="password_conf" /></td>
|
168
|
-
|
169
|
-
</tr>
|
170
|
-
|
171
|
-
<tr>
|
172
|
-
|
173
|
-
<th>情報メールの受信<span class="aster">※</span></th>
|
174
|
-
|
175
|
-
<td><input type="radio" name="optin" value="1" id="optin1" />受信する<input type="radio" name="optin" value="2" id="optin2" checked="checked" />受信しない</td>
|
176
|
-
|
177
|
-
</tr>
|
178
|
-
|
179
29
|
</tbody>
|
180
30
|
|
181
31
|
</table>
|
@@ -188,47 +38,149 @@
|
|
188
38
|
|
189
39
|
```
|
190
40
|
|
191
|
-
|
41
|
+
public function index(){
|
192
42
|
|
193
|
-
|
43
|
+
//SESSIONデータ
|
194
44
|
|
195
|
-
$
|
45
|
+
$session_array = array();
|
196
46
|
|
197
|
-
$
|
47
|
+
$session_array = $this->session->all_userdata();
|
198
48
|
|
199
|
-
|
49
|
+
//POSTデータ
|
200
50
|
|
201
|
-
$
|
51
|
+
$post_array = array();
|
202
52
|
|
203
|
-
$
|
53
|
+
$post_array = $this->input->post();
|
204
54
|
|
205
|
-
$
|
55
|
+
$data = array();
|
206
56
|
|
207
|
-
|
57
|
+
//POSTデータが存在する
|
208
58
|
|
209
|
-
|
59
|
+
if(!empty($post_array)){
|
210
60
|
|
211
|
-
|
61
|
+
//入力チェック
|
212
62
|
|
213
|
-
$this->
|
63
|
+
if($this->validation_check()){
|
214
64
|
|
215
|
-
$t
|
65
|
+
$data = array_merge($data,$post_array);
|
216
66
|
|
217
|
-
$this->
|
67
|
+
$this->session->set_userdata($post_array);
|
218
68
|
|
219
|
-
$
|
69
|
+
$data["title"] = "会員情報(新規登録)";
|
220
70
|
|
71
|
+
//HeaderのVIEW
|
72
|
+
|
73
|
+
$this->load->view('/header/header_011',$data);
|
74
|
+
|
221
|
-
$this->
|
75
|
+
$this->load->view('/common/parts_not_login',$data);
|
76
|
+
|
77
|
+
$this->load->view('/member/confirm',$data);
|
78
|
+
|
79
|
+
$this->load->view('/common/parts_footer',$data);
|
80
|
+
|
81
|
+
}
|
82
|
+
|
83
|
+
}else{
|
84
|
+
|
85
|
+
$data["title"] = "会員情報(新規登録)";
|
86
|
+
|
87
|
+
//HeaderのVIEW
|
88
|
+
|
89
|
+
$this->load->view('/header/header_011',$data);
|
90
|
+
|
91
|
+
$this->load->view('/common/parts_not_login',$data);
|
92
|
+
|
93
|
+
$this->load->view('/member/input',$data);
|
94
|
+
|
95
|
+
$this->load->view('/common/parts_footer',$data);
|
96
|
+
|
97
|
+
}
|
98
|
+
|
99
|
+
}
|
222
100
|
|
223
101
|
|
224
102
|
|
103
|
+
//入力チェック
|
104
|
+
|
105
|
+
private function validation_check(){
|
106
|
+
|
107
|
+
//SESSIONデータ
|
108
|
+
|
109
|
+
$session_array = array();
|
110
|
+
|
111
|
+
$session_array = $this->session->all_userdata();
|
112
|
+
|
113
|
+
//POSTデータ
|
114
|
+
|
115
|
+
$post_array = array();
|
116
|
+
|
117
|
+
$post_array = $this->input->post();
|
118
|
+
|
119
|
+
//カテゴリー
|
120
|
+
|
121
|
+
$category_array = $this->category->Get_Parent_Category();
|
122
|
+
|
123
|
+
$data["category_str"] = $this->common->Create_Category_List($category_array);
|
124
|
+
|
125
|
+
//検証ルール
|
126
|
+
|
127
|
+
$this->form_validation->set_rules('email','メールアドレス',array('required','min_length[10]','max_length[128]','matches[email_address_conf]','callback_check_duplicate_email'));
|
128
|
+
|
129
|
+
$this->form_validation->set_rules('email_conf','メールアドレス(確認)',array('required','min_length[10]','max_length[128]','matches[email_address_conf]'));
|
130
|
+
|
131
|
+
//入力チェック
|
132
|
+
|
133
|
+
if($this->form_validation->run() == FALSE ){
|
134
|
+
|
135
|
+
$this->form_validation->set_error_delimiters('<span class="em">', '</span>');
|
136
|
+
|
137
|
+
//配列を結合する
|
138
|
+
|
139
|
+
$data = array_merge($post_array,$data);
|
140
|
+
|
141
|
+
$data["title"] = "会員情報(新規登録エラー)";
|
142
|
+
|
143
|
+
//HeaderのVIEW
|
144
|
+
|
145
|
+
$this->load->view('/header/header_011',$data);
|
146
|
+
|
147
|
+
$this->load->view('/common/parts_not_login',$data);
|
148
|
+
|
149
|
+
$this->load->view('/member/input_error',$data);
|
150
|
+
|
151
|
+
$this->load->view('/common/parts_footer',$data);
|
152
|
+
|
153
|
+
return FALSE;
|
154
|
+
|
155
|
+
}else{
|
156
|
+
|
157
|
+
return TRUE;
|
158
|
+
|
159
|
+
}
|
160
|
+
|
161
|
+
}
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
//重複確認
|
166
|
+
|
167
|
+
public function check_duplicate_email(){
|
168
|
+
|
169
|
+
if($this->duplicate_check->Check_Duplicate_Email()){
|
170
|
+
|
171
|
+
$this->form_validation->set_message("check_duplicate_email","この%s は、すでに利用されています。");
|
172
|
+
|
173
|
+
return FALSE;
|
174
|
+
|
175
|
+
}
|
176
|
+
|
177
|
+
}
|
178
|
+
|
225
179
|
```
|
226
180
|
|
227
|
-
としているんですが、
|
181
|
+
としているんですが、入力を行っても
|
228
182
|
|
229
183
|
emailが「メールアドレス欄は必須フィールドです。」
|
230
|
-
|
231
|
-
password が「パスワード欄が password_conf欄と同じではありません」
|
232
184
|
|
233
185
|
と表示されてしまいます。
|
234
186
|
|