質問編集履歴

4

追記しました。

2018/06/22 07:33

投稿

nonnon1104
nonnon1104

スコア12

test CHANGED
File without changes
test CHANGED
@@ -299,3 +299,27 @@
299
299
  </form>
300
300
 
301
301
  ```
302
+
303
+
304
+
305
+ 下記のコードも試してみましたが送信できませんでした。
306
+
307
+
308
+
309
+ ```php
310
+
311
+ if( empty ($mail) || empty ($mail2) ) {
312
+
313
+
314
+
315
+ print"メールアドレスが入力されていません" ; }
316
+
317
+ elseif($mail ! == $mail2){
318
+
319
+ print"メールアドレスが一致しません" ; }
320
+
321
+
322
+
323
+ else{print $mail;}
324
+
325
+ ```

3

追加いたしました。

2018/06/22 07:33

投稿

nonnon1104
nonnon1104

スコア12

test CHANGED
File without changes
test CHANGED
@@ -48,4 +48,254 @@
48
48
 
49
49
 
50
50
 
51
+ //print($hantei);
52
+
53
+
54
+
55
+ if ($hantei == 'ng') {
56
+
57
+ print("<p align='center'>必須項目が抜けているため送信できませんでした。<br>お手数ですが、もう一度ご入力ください。<a href='index.html'>トップページへ戻る</a></p>");
58
+
59
+ } else {
60
+
61
+ $send_data = "【お名前】\n".$name1."様\n\n【郵便番号】\n".$yuubin."\n\n【住所】\n".$address."\n\n【メールアドレス】\n".$mail."\n\n【電話番号】\n".$telephone."\n\n【お問合わせ内容】\n".$memo."\n\n";
62
+
63
+
64
+
65
+ //print($send_data);
66
+
67
+
68
+
69
+ /////////////////////////////////////////////////////送信////////////////////////////////////////////////////////////
70
+
71
+ $msg = "ホームページからエントリーがありました。エントリー内容は下記のとおりです。\n\nエントリー内容\n\n".$send_data."\n\n以上、対応をよろしくお願いいたします。";
72
+
73
+
74
+
75
+ mb_language('ja');
76
+
77
+ mb_internal_encoding('UTF-8');
78
+
79
+
80
+
81
+ $header = mb_encode_mimeheader($mail);
82
+
83
+
84
+
85
+ $address = '000@000'; //------------------------------------------------------------------------------メールアドレスに要変更
86
+
87
+ $hantei1 = mb_send_mail($address, 'ホームページからのエントリーです。', $msg, 'From:'.$header);
88
+
89
+
90
+
91
+ /////////////////////////////////////////////////////お客様に送信////////////////////////////////////////////////////////////
92
+
93
+ $store_data = '
94
+
95
+ *****************************************************
96
+
97
+ 000
98
+
99
+ *****************************************************';
100
+
101
+
102
+
103
+ $msg = $name1."様\n\n【000】ホームページからのご応募誠にありがとうございます。\n下記の内容でお問い合わせを承りました。\nこのメールは自動送信されております。\nご応募をいただきました内容については後程、担当の者よりご連絡させていただきます。\n今しばらくお待ちくださいますようお願い申し上げます。\n\nご応募内容\n\n".$send_data."\n\n改めまして、ご応募厚く御礼申し上げます。\n\n".$store_data;
104
+
105
+
106
+
107
+ $title = '【000】ホームページからのご応募誠にありがとうございます';
108
+
109
+
110
+
111
+ mb_language('ja');
112
+
113
+ mb_internal_encoding('UTF-8');
114
+
115
+
116
+
117
+ $header = mb_encode_mimeheader('00@000'); //------------------------------------------------------------メールアドレスに要変更
118
+
119
+
120
+
121
+ $hantei2 = mb_send_mail($mail, $title, $msg, 'From:'.$header);
122
+
123
+
124
+
125
+ //print("判定1:".$hantei1."<br>");
126
+
127
+ //print("判定2:".$hantei2."<br>");
128
+
129
+
130
+
131
+ if ($hantei1 && $hantei2) {
132
+
133
+ print("<p style='padding-top:50px' align='center'>");
134
+
135
+ print("ご応募、<br class='sp'>誠に有難うございます。<br><br>");
136
+
137
+ print("ご応募いただきました<br class='sp'>内容につきましては、<br class='sp'>担当者より改めてご連絡差し上げます。<br>");
138
+
139
+ print("万が一、連絡がない場合は<br class='sp'>大変恐れ入りますが、<br>お電話にて<br class='sp'>お問い合わせくださいますよう<br class='sp'>お願い申し上げます。<br><br>");
140
+
141
+ print('</p>');
142
+
143
+
144
+
145
+ print("<p style='margin-bottom:70px' align='center'>");
146
+
147
+ print("改めまして、<br class='sp'>ご応募厚く御礼申し上げます。");
148
+
149
+ print('</p>');
150
+
151
+
152
+
153
+ print("<p style='margin-bottom:50px' align='center'><a href='./'>トップページへ戻る</a></p>");
154
+
155
+ }
156
+
157
+ }
158
+
159
+
160
+
161
+
162
+
51
163
  ```
164
+
165
+
166
+
167
+ ```HTML
168
+
169
+ <form method="post" action="complete.php">
170
+
171
+ <table class="entry">
172
+
173
+ <tbody>
174
+
175
+ <tr>
176
+
177
+ <th>お名前<span>※</span></th>
178
+
179
+ <td class="data fst">
180
+
181
+ <input type="text" name="name1" id="name1" required>
182
+
183
+ </td>
184
+
185
+ </tr><tr>
186
+
187
+ <td class="bar" colspan="6"></td>
188
+
189
+ </tr>
190
+
191
+ <tr>
192
+
193
+ <th>郵便番号</th>
194
+
195
+ <td class="data fst">
196
+
197
+ <input type="text" name="yuubin" id="yuubin" placeholder="例:000-0000">
198
+
199
+ </td>
200
+
201
+ </tr>
202
+
203
+ <tr>
204
+
205
+ <td class="bar" colspan="6"></td>
206
+
207
+ </tr>
208
+
209
+ <tr>
210
+
211
+ <th>住所<span>※</span></th>
212
+
213
+ <td class="data fst">
214
+
215
+ <input type="text" name="address" id="address" placeholder="例:" required>
216
+
217
+ </td>
218
+
219
+ </tr><tr>
220
+
221
+ <td class="bar" colspan="6"></td>
222
+
223
+ </tr>
224
+
225
+ <tr>
226
+
227
+ <th>メールアドレス<span>※</span></th>
228
+
229
+ <td class="data fst">
230
+
231
+ <input type="email" name="mail" id="mail" placeholder="例:@example.com" required><span>※半角入力</span>
232
+
233
+ </td>
234
+
235
+ </tr>
236
+
237
+ <tr>
238
+
239
+ <td class="bar" colspan="6"></td>
240
+
241
+ </tr>
242
+
243
+ <tr>
244
+
245
+ <th>メールアドレス(確認)<span>※</span></th>
246
+
247
+ <td class="data fst">
248
+
249
+ <input type="email" name="mail2" id="mail2" placeholder="例:@example.com" required><span>※半角入力</span>
250
+
251
+ </td>
252
+
253
+ </tr><tr>
254
+
255
+ <td class="bar" colspan="6"></td>
256
+
257
+ </tr>
258
+
259
+ <tr>
260
+
261
+ <th>ご連絡先電話番号</th>
262
+
263
+ <td class="data fst">
264
+
265
+ <input type="tel" name="telephone" id="telephone" placeholder="例:"><span>※半角入力</span>
266
+
267
+ </td>
268
+
269
+ </tr>
270
+
271
+ <tr>
272
+
273
+ <td class="bar" colspan="6"></td>
274
+
275
+ </tr>
276
+
277
+ <tr>
278
+
279
+ <th>お問い合わせ内容<span>※</span></th>
280
+
281
+ <td class="data fst">
282
+
283
+ <textarea name="memo" id="memo" placeholder="例:" required></textarea>
284
+
285
+ </td>
286
+
287
+ </tr>
288
+
289
+ </tbody>
290
+
291
+ </table>
292
+
293
+ <div class="rec_button-box">
294
+
295
+ <a class="rec-button" href="#"><input type="submit" name="submit" id="submit" value="送 信"></a>
296
+
297
+ </div>
298
+
299
+ </form>
300
+
301
+ ```

2

修正いたしました。

2018/06/22 07:20

投稿

nonnon1104
nonnon1104

スコア12

test CHANGED
File without changes
test CHANGED
@@ -6,42 +6,46 @@
6
6
 
7
7
  ```PHP
8
8
 
9
- <?php
9
+ <?php
10
10
 
11
- $mail=htmlspecialchars($_POST["mail"]);
11
+ $name1 = htmlspecialchars($_POST['name1']);
12
12
 
13
- $mail2=htmlspecialchars($_POST["mail2"]);
13
+ $yuubin = htmlspecialchars($_POST['yuubin']);
14
14
 
15
- $telephone=htmlspecialchars($_POST["telephone"]);
15
+ $address = htmlspecialchars($_POST['address']);
16
16
 
17
+ $mail = htmlspecialchars($_POST['mail']);
18
+
19
+ $mail2 = htmlspecialchars($_POST['mail2']);
20
+
21
+ $telephone = htmlspecialchars($_POST['telephone']);
22
+
17
- $memo=htmlspecialchars($_POST["memo"]);
23
+ $memo = htmlspecialchars($_POST['memo']);
18
24
 
19
25
 
20
26
 
21
- $hantei="ng";
27
+ $hantei = 'ng';
22
28
 
23
29
 
24
30
 
25
- if($name1!= "" && $address!="" && $mail!="" && $mail2!="" && $memo!=""){
31
+ if ($name1 != '' && $address != '' && $mail != '' && $mail2 != '' && $memo != '') {
26
32
 
27
- $hantei="ok";
33
+ $hantei = 'ok';
28
34
 
29
- }else{
35
+ } else {
30
36
 
31
- $hantei="ng";
37
+ $hantei = 'ng';
32
38
 
33
- }
39
+ }
34
40
 
35
-
41
+ $error = '';
36
42
 
37
- $error="";
43
+ if ($_POST['mail'] !== $_POST['mail2']) {
38
44
 
39
-
45
+ $error = 'メールアドレスが一致しません。';
40
46
 
41
- if($_POST['mail2'] !== $_POST['mail2'] ){
47
+ }
42
48
 
43
- $error="メールアドレスが一致しません。";
44
49
 
45
- }
46
50
 
47
51
  ```

1

インデント揃えました

2018/06/22 07:02

投稿

nonnon1104
nonnon1104

スコア12

test CHANGED
File without changes
test CHANGED
@@ -6,44 +6,42 @@
6
6
 
7
7
  ```PHP
8
8
 
9
- <?php
9
+ <?php
10
10
 
11
-
11
+ $mail=htmlspecialchars($_POST["mail"]);
12
12
 
13
- $mail=htmlspecialchars($_POST["mail"]);
13
+ $mail2=htmlspecialchars($_POST["mail2"]);
14
14
 
15
- $mail2=htmlspecialchars($_POST["mail2"]);
15
+ $telephone=htmlspecialchars($_POST["telephone"]);
16
16
 
17
- $telephone=htmlspecialchars($_POST["telephone"]);
18
-
19
- $memo=htmlspecialchars($_POST["memo"]);
17
+ $memo=htmlspecialchars($_POST["memo"]);
20
18
 
21
19
 
22
20
 
23
- $hantei="ng";
21
+ $hantei="ng";
24
22
 
25
23
 
26
24
 
27
- if($name1!= "" && $address!="" && $mail!="" && $mail2!="" && $memo!=""){
25
+ if($name1!= "" && $address!="" && $mail!="" && $mail2!="" && $memo!=""){
28
26
 
29
- $hantei="ok";
27
+ $hantei="ok";
30
28
 
31
- }else{
29
+ }else{
32
30
 
33
- $hantei="ng";
31
+ $hantei="ng";
34
32
 
35
- }
33
+ }
36
34
 
37
35
 
38
36
 
39
- $error="";
37
+ $error="";
40
38
 
41
39
 
42
40
 
43
- if($_POST['mail2'] !== $_POST['mail2'] ){
41
+ if($_POST['mail2'] !== $_POST['mail2'] ){
44
42
 
45
-   $error="メールアドレスが一致しません。";
43
+ $error="メールアドレスが一致しません。";
46
44
 
47
-     }
45
+ }
48
46
 
49
47
  ```