質問するログイン新規登録

質問編集履歴

4

追記しました。

2018/06/22 07:33

投稿

nonnon1104
nonnon1104

スコア12

title CHANGED
File without changes
body CHANGED
@@ -148,4 +148,16 @@
148
148
  <a class="rec-button" href="#"><input type="submit" name="submit" id="submit" value="送 信"></a>
149
149
  </div>
150
150
  </form>
151
+ ```
152
+
153
+ 下記のコードも試してみましたが送信できませんでした。
154
+
155
+ ```php
156
+ if( empty ($mail) || empty ($mail2) ) {
157
+
158
+ print"メールアドレスが入力されていません" ; }
159
+ elseif($mail ! == $mail2){
160
+ print"メールアドレスが一致しません" ; }
161
+
162
+ else{print $mail;}
151
163
  ```

3

追加いたしました。

2018/06/22 07:33

投稿

nonnon1104
nonnon1104

スコア12

title CHANGED
File without changes
body CHANGED
@@ -23,4 +23,129 @@
23
23
  $error = 'メールアドレスが一致しません。';
24
24
  }
25
25
 
26
+ //print($hantei);
27
+
28
+ if ($hantei == 'ng') {
29
+ print("<p align='center'>必須項目が抜けているため送信できませんでした。<br>お手数ですが、もう一度ご入力ください。<a href='index.html'>トップページへ戻る</a></p>");
30
+ } else {
31
+ $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";
32
+
33
+ //print($send_data);
34
+
35
+ /////////////////////////////////////////////////////送信////////////////////////////////////////////////////////////
36
+ $msg = "ホームページからエントリーがありました。エントリー内容は下記のとおりです。\n\nエントリー内容\n\n".$send_data."\n\n以上、対応をよろしくお願いいたします。";
37
+
38
+ mb_language('ja');
39
+ mb_internal_encoding('UTF-8');
40
+
41
+ $header = mb_encode_mimeheader($mail);
42
+
43
+ $address = '000@000'; //------------------------------------------------------------------------------メールアドレスに要変更
44
+ $hantei1 = mb_send_mail($address, 'ホームページからのエントリーです。', $msg, 'From:'.$header);
45
+
46
+ /////////////////////////////////////////////////////お客様に送信////////////////////////////////////////////////////////////
47
+ $store_data = '
48
+ *****************************************************
49
+ 000
50
+ *****************************************************';
51
+
52
+ $msg = $name1."様\n\n【000】ホームページからのご応募誠にありがとうございます。\n下記の内容でお問い合わせを承りました。\nこのメールは自動送信されております。\nご応募をいただきました内容については後程、担当の者よりご連絡させていただきます。\n今しばらくお待ちくださいますようお願い申し上げます。\n\nご応募内容\n\n".$send_data."\n\n改めまして、ご応募厚く御礼申し上げます。\n\n".$store_data;
53
+
54
+ $title = '【000】ホームページからのご応募誠にありがとうございます';
55
+
56
+ mb_language('ja');
57
+ mb_internal_encoding('UTF-8');
58
+
59
+ $header = mb_encode_mimeheader('00@000'); //------------------------------------------------------------メールアドレスに要変更
60
+
61
+ $hantei2 = mb_send_mail($mail, $title, $msg, 'From:'.$header);
62
+
63
+ //print("判定1:".$hantei1."<br>");
64
+ //print("判定2:".$hantei2."<br>");
65
+
66
+ if ($hantei1 && $hantei2) {
67
+ print("<p style='padding-top:50px' align='center'>");
68
+ print("ご応募、<br class='sp'>誠に有難うございます。<br><br>");
69
+ print("ご応募いただきました<br class='sp'>内容につきましては、<br class='sp'>担当者より改めてご連絡差し上げます。<br>");
70
+ print("万が一、連絡がない場合は<br class='sp'>大変恐れ入りますが、<br>お電話にて<br class='sp'>お問い合わせくださいますよう<br class='sp'>お願い申し上げます。<br><br>");
71
+ print('</p>');
72
+
73
+ print("<p style='margin-bottom:70px' align='center'>");
74
+ print("改めまして、<br class='sp'>ご応募厚く御礼申し上げます。");
75
+ print('</p>');
76
+
77
+ print("<p style='margin-bottom:50px' align='center'><a href='./'>トップページへ戻る</a></p>");
78
+ }
79
+ }
80
+
81
+
82
+ ```
83
+
84
+ ```HTML
85
+ <form method="post" action="complete.php">
86
+ <table class="entry">
87
+ <tbody>
88
+ <tr>
89
+ <th>お名前<span>※</span></th>
90
+ <td class="data fst">
91
+ <input type="text" name="name1" id="name1" required>
92
+ </td>
93
+ </tr><tr>
94
+ <td class="bar" colspan="6"></td>
95
+ </tr>
96
+ <tr>
97
+ <th>郵便番号</th>
98
+ <td class="data fst">
99
+ <input type="text" name="yuubin" id="yuubin" placeholder="例:000-0000">
100
+ </td>
101
+ </tr>
102
+ <tr>
103
+ <td class="bar" colspan="6"></td>
104
+ </tr>
105
+ <tr>
106
+ <th>住所<span>※</span></th>
107
+ <td class="data fst">
108
+ <input type="text" name="address" id="address" placeholder="例:" required>
109
+ </td>
110
+ </tr><tr>
111
+ <td class="bar" colspan="6"></td>
112
+ </tr>
113
+ <tr>
114
+ <th>メールアドレス<span>※</span></th>
115
+ <td class="data fst">
116
+ <input type="email" name="mail" id="mail" placeholder="例:@example.com" required><span>※半角入力</span>
117
+ </td>
118
+ </tr>
119
+ <tr>
120
+ <td class="bar" colspan="6"></td>
121
+ </tr>
122
+ <tr>
123
+ <th>メールアドレス(確認)<span>※</span></th>
124
+ <td class="data fst">
125
+ <input type="email" name="mail2" id="mail2" placeholder="例:@example.com" required><span>※半角入力</span>
126
+ </td>
127
+ </tr><tr>
128
+ <td class="bar" colspan="6"></td>
129
+ </tr>
130
+ <tr>
131
+ <th>ご連絡先電話番号</th>
132
+ <td class="data fst">
133
+ <input type="tel" name="telephone" id="telephone" placeholder="例:"><span>※半角入力</span>
134
+ </td>
135
+ </tr>
136
+ <tr>
137
+ <td class="bar" colspan="6"></td>
138
+ </tr>
139
+ <tr>
140
+ <th>お問い合わせ内容<span>※</span></th>
141
+ <td class="data fst">
142
+ <textarea name="memo" id="memo" placeholder="例:" required></textarea>
143
+ </td>
144
+ </tr>
145
+ </tbody>
146
+ </table>
147
+ <div class="rec_button-box">
148
+ <a class="rec-button" href="#"><input type="submit" name="submit" id="submit" value="送 信"></a>
149
+ </div>
150
+ </form>
26
151
  ```

2

修正いたしました。

2018/06/22 07:20

投稿

nonnon1104
nonnon1104

スコア12

title CHANGED
File without changes
body CHANGED
@@ -2,23 +2,25 @@
2
2
  何卒ご教示お願いいたします。(少し削除しております)
3
3
 
4
4
  ```PHP
5
- <?php
5
+ <?php
6
+ $name1 = htmlspecialchars($_POST['name1']);
7
+ $yuubin = htmlspecialchars($_POST['yuubin']);
8
+ $address = htmlspecialchars($_POST['address']);
6
- $mail=htmlspecialchars($_POST["mail"]);
9
+ $mail = htmlspecialchars($_POST['mail']);
7
- $mail2=htmlspecialchars($_POST["mail2"]);
10
+ $mail2 = htmlspecialchars($_POST['mail2']);
8
- $telephone=htmlspecialchars($_POST["telephone"]);
11
+ $telephone = htmlspecialchars($_POST['telephone']);
9
- $memo=htmlspecialchars($_POST["memo"]);
12
+ $memo = htmlspecialchars($_POST['memo']);
10
13
 
11
- $hantei="ng";
14
+ $hantei = 'ng';
12
15
 
13
- if($name1!= "" && $address!="" && $mail!="" && $mail2!="" && $memo!=""){
16
+ if ($name1 != '' && $address != '' && $mail != '' && $mail2 != '' && $memo != '') {
14
- $hantei="ok";
17
+ $hantei = 'ok';
15
- }else{
18
+ } else {
16
- $hantei="ng";
19
+ $hantei = 'ng';
17
- }
20
+ }
18
-
19
- $error="";
21
+ $error = '';
20
-
21
- if($_POST['mail2'] !== $_POST['mail2'] ){
22
+ if ($_POST['mail'] !== $_POST['mail2']) {
22
- $error="メールアドレスが一致しません。";
23
+ $error = 'メールアドレスが一致しません。';
23
- }
24
+ }
25
+
24
26
  ```

1

インデント揃えました

2018/06/22 07:02

投稿

nonnon1104
nonnon1104

スコア12

title CHANGED
File without changes
body CHANGED
@@ -2,24 +2,23 @@
2
2
  何卒ご教示お願いいたします。(少し削除しております)
3
3
 
4
4
  ```PHP
5
- <?php
5
+ <?php
6
-
7
- $mail=htmlspecialchars($_POST["mail"]);
6
+ $mail=htmlspecialchars($_POST["mail"]);
8
- $mail2=htmlspecialchars($_POST["mail2"]);
7
+ $mail2=htmlspecialchars($_POST["mail2"]);
9
- $telephone=htmlspecialchars($_POST["telephone"]);
8
+ $telephone=htmlspecialchars($_POST["telephone"]);
10
- $memo=htmlspecialchars($_POST["memo"]);
9
+ $memo=htmlspecialchars($_POST["memo"]);
11
10
 
12
- $hantei="ng";
11
+ $hantei="ng";
13
12
 
14
- if($name1!= "" && $address!="" && $mail!="" && $mail2!="" && $memo!=""){
13
+ if($name1!= "" && $address!="" && $mail!="" && $mail2!="" && $memo!=""){
15
- $hantei="ok";
14
+ $hantei="ok";
16
- }else{
15
+ }else{
17
- $hantei="ng";
16
+ $hantei="ng";
18
- }
17
+ }
19
18
 
20
- $error="";
19
+ $error="";
21
20
 
22
- if($_POST['mail2'] !== $_POST['mail2'] ){
21
+ if($_POST['mail2'] !== $_POST['mail2'] ){
23
-   $error="メールアドレスが一致しません。";
22
+ $error="メールアドレスが一致しません。";
24
-     }
23
+ }
25
24
  ```