質問編集履歴
2
コード修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,15 +1,11 @@
|
|
1
1
|
以下のようにPHPとHTMLを使用しお問合せフォームを作りました。(contact.php)
|
2
|
-
確認するボタンを押すと「confirm.php」へも飛び、contact.phpで打ったものを反映させるようにしたいのですが
|
2
|
+
確認するボタンを押すと「confirm.php」へも飛び、contact.phpで打ったものを反映させるようにしたいのですが飛びません。
|
3
3
|
|
4
4
|
また、エラー設定もしているのですがエラーが反映されません。
|
5
5
|
|
6
|
-
どのようにしたら出ますでしょうか?
|
7
|
-
また、このcontact.phpそのものにエラーがかかってしまいました。
|
8
|
-
|
9
|
-
お力添えお願いします。
|
10
6
|
必要に応じgit.hubでの公開も可能です。
|
11
7
|
|
12
|
-
|
8
|
+
|
13
9
|
```php
|
14
10
|
<?php
|
15
11
|
session_start();
|
@@ -18,7 +14,7 @@
|
|
18
14
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
19
15
|
$post = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
|
20
16
|
|
21
|
-
|
17
|
+
|
22
18
|
if ($post['name'] === '') {
|
23
19
|
$error['name'] = 'blank';
|
24
20
|
}
|
@@ -27,12 +23,15 @@
|
|
27
23
|
} else if (!filter_var($post['email'], FILTER_VALIDATE_EMAIL)) {
|
28
24
|
$error['email'] = 'email';
|
29
25
|
}
|
26
|
+
if ($post['tel'] === '') {
|
27
|
+
$error['tel'] = 'blank';
|
28
|
+
}
|
30
29
|
if ($post['contact'] === '') {
|
31
30
|
$error['contact'] = 'blank';
|
32
31
|
}
|
33
32
|
|
34
33
|
if (count($error) === 0) {
|
35
|
-
|
34
|
+
|
36
35
|
$_SESSION['form'] = $post;
|
37
36
|
header('Location: confirm.php');
|
38
37
|
exit();
|
@@ -43,27 +42,25 @@
|
|
43
42
|
}
|
44
43
|
}
|
45
44
|
?>
|
45
|
+
|
46
46
|
<!DOCTYPE html>
|
47
|
-
<html lang="ja">
|
48
47
|
<html lang="ja">
|
49
48
|
<head>
|
50
|
-
|
51
49
|
<meta charset="UTF-8">
|
52
50
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
53
|
-
|
54
51
|
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
|
55
52
|
<link rel="shortcut icon" href="assets/images/logo2-160x136.png" type="image/x-icon">
|
56
53
|
<meta name="description" content="">
|
57
|
-
|
58
|
-
|
59
|
-
<title>
|
54
|
+
<title>contact</title>
|
60
|
-
<link rel="stylesheet" href="assets/web/assets/mobirise-icons/mobirise-icons.css">
|
61
55
|
<link rel="stylesheet" href="assets/tether/tether.min.css">
|
62
56
|
<link rel="stylesheet" href="assets/bootstrap/css/bootstrap.min.css">
|
63
57
|
<link rel="stylesheet" href="assets/bootstrap/css/bootstrap-grid.min.css">
|
64
58
|
<link rel="stylesheet" href="assets/bootstrap/css/bootstrap-reboot.min.css">
|
65
59
|
<link rel="stylesheet" href="assets/animatecss/animate.css">
|
66
60
|
<link rel="stylesheet" href="assets/dropdown/css/style.css">
|
61
|
+
<link rel="stylesheet" href="assets/formstyler/jquery.formstyler.css">
|
62
|
+
<link rel="stylesheet" href="assets/formstyler/jquery.formstyler.theme.css">
|
63
|
+
<link rel="stylesheet" href="assets/datepicker/jquery.datetimepicker.min.css">
|
67
64
|
<link rel="stylesheet" href="assets/theme/css/style.css">
|
68
65
|
<link rel="preload" href="https://fonts.googleapis.com/css?family=Libre+Baskerville:400,400i,700&display=swap" as="style" onload="this.onload=null;this.rel='stylesheet'">
|
69
66
|
<noscript><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Libre+Baskerville:400,400i,700&display=swap"></noscript>
|
@@ -71,104 +68,127 @@
|
|
71
68
|
<noscript><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto+Slab:100,200,300,400,500,600,700,800,900&display=swap"></noscript>
|
72
69
|
<link rel="preload" as="style" href="assets/mobirise/css/mbr-additional.css"><link rel="stylesheet" href="assets/mobirise/css/mbr-additional.css" type="text/css">
|
73
70
|
</head>
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
</
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
71
|
+
<body>
|
72
|
+
<section class="extMenu11 menu cid-sPFSaL3757" once="menu" id="extMenu11-8q">
|
73
|
+
<nav class="navbar navbar-expand beta-menu navbar-dropdown align-items-center navbar-fixed-top navbar-toggleable-sm">
|
74
|
+
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
75
|
+
<div class="hamburger">
|
76
|
+
<span></span>
|
77
|
+
|
78
|
+
<span></span>
|
79
|
+
</div>
|
80
|
+
</button>
|
81
|
+
<div class="menu-logo">
|
82
|
+
<div class="navbar-brand">
|
83
|
+
<span class="navbar-logo">
|
84
|
+
<a href="index.html">
|
85
|
+
<img src="assets/images/logo2-160x136.png" alt="菜々海" style="height: 6rem;">
|
86
|
+
</a>
|
87
|
+
</span>
|
88
|
+
<span class="navbar-caption-wrap">
|
89
|
+
<a class="navbar-caption text-black text-primary display-5" href="index.html">一般社団法人</a>
|
90
|
+
</span>
|
91
|
+
</div>
|
92
|
+
</div>
|
93
|
+
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
94
|
+
<ul class="navbar-nav nav-dropdown" data-app-modern-menu="true">
|
95
|
+
<li class="nav-item">
|
96
|
+
<a class="nav-link link text-black text-primary display-4" href="index.html">ホーム</a>
|
97
|
+
</li>
|
98
|
+
//省略
|
99
|
+
</ul>
|
100
|
+
<div class="navbar-buttons mbr-section-btn"><a class="btn btn-sm btn-warning display-4" href="contact.html">問い合わせる</a></div>
|
101
|
+
</div>
|
102
|
+
</nav>
|
103
|
+
</section>
|
104
|
+
<section class="content5 cid-sPFS2QoTlQ" id="content5-8p">
|
105
|
+
<div class="container">
|
106
|
+
<div class="row justify-content-center">
|
107
|
+
<div class="col-md-12 col-lg-10">
|
108
|
+
<p class="mbr-text mbr-fonts-style display-2"><strong>お問い合わせフォーム</strong></p>
|
109
|
+
</div>
|
110
|
+
</div>
|
111
|
+
</div>
|
112
|
+
</section>
|
113
|
+
<section class="form1 directm4_form1 cid-sDvvMLREBx" id="form1-4p">
|
114
|
+
<div class="container">
|
115
|
+
<div class="row justify-content-center mt-5">
|
116
|
+
<div class="col-lg-9 mbr-form form" data-form-type="formoid">
|
117
|
+
<form action="./contact.php" method="POST">
|
118
|
+
<div class="row justify-content-center">
|
119
|
+
<div class="col-md-8">
|
120
|
+
<p class="mbr-text mbr-fonts-style align-center mb-4 display-7">お客さまからのお問い合わせをお問い合わせフォームにて受け付けております。
|
121
|
+
<br>必要事項をご記入の上、「確認画面」を押してください。 </p>
|
122
|
+
<div class="form-row">
|
123
|
+
</div>
|
124
|
+
<div class="dragArea form-row">
|
98
125
|
|
99
|
-
|
126
|
+
|
100
|
-
<li class="nav-item"><a class="nav-link link text-black text-primary display-4" href="service.html">サービス内容</a></li>
|
101
|
-
<li class="nav-item"><a class="nav-link link text-black text-primary display-4" href="news.html">お知らせ</a></li></ul>
|
102
|
-
<div class="navbar-buttons mbr-section-btn"><a class="btn btn-sm btn-warning display-4" href="contact.php">問い合わせる</a></div>
|
103
|
-
</div>
|
104
|
-
</nav>
|
105
|
-
</section>
|
106
|
-
<!-- お問合せフォーム画面 -->
|
107
|
-
<body>
|
108
|
-
<div class="container">
|
109
|
-
<form action="" method="POST" novalidate>
|
110
|
-
<p>お問い合わせ</p>
|
111
|
-
|
127
|
+
<div class="col-lg-12 form-group" data-for="name">
|
112
|
-
<div class="row">
|
113
|
-
<div class="col-2">
|
114
|
-
|
128
|
+
<label for="inputName">お名前</label>
|
115
|
-
</div>
|
116
|
-
<div class="col-2">
|
117
|
-
<p class="require_item">必須</p>
|
118
|
-
</div>
|
119
|
-
<div class="col-md-8">
|
120
|
-
|
129
|
+
<input type="text" name="name" id="inputName" class="form-control" value="<?php echo htmlspecialchars($post['name']); ?>" required autofocus>
|
121
130
|
<?php if ($error['name'] === 'blank'): ?>
|
122
131
|
<p class="error_msg">※お名前をご記入下さい</p>
|
123
132
|
<?php endif; ?>
|
124
|
-
|
133
|
+
</div>
|
125
|
-
</div>
|
126
|
-
</div>
|
127
|
-
<div class="form-group">
|
128
|
-
<div class="row">
|
129
|
-
<div class="col-2">
|
130
|
-
<label for="inputEmail">メールアドレス</label>
|
131
|
-
</div>
|
132
134
|
|
133
|
-
|
135
|
+
<div class="col-lg-12 form-group" data-for="email">
|
136
|
+
<label for="inputName">メールアドレス</label>
|
137
|
+
<input type="email" name="email" id="inputEmail" class="form-control" value="<?php echo htmlspecialchars($post['email']); ?>" required>
|
138
|
+
<?php if ($error['email'] === 'blank'): ?>
|
134
|
-
|
139
|
+
<p class="error_msg">※メールアドレスをご記入下さい</p>
|
140
|
+
<?php endif; ?>
|
141
|
+
<?php if ($error['email'] === 'email'): ?>
|
142
|
+
<p class="error_msg">※メールアドレスを正しくご記入ください</p>
|
143
|
+
<?php endif; ?>
|
135
|
-
|
144
|
+
</div>
|
136
145
|
|
137
|
-
|
146
|
+
<div data-for="tel" class="col-lg-12 form-group">
|
147
|
+
<label for="inputName">電話番号</label>
|
138
|
-
|
148
|
+
<input type="tel" name="tel" id="inputName" class="form-control" value="<?php echo htmlspecialchars($post['tel']); ?>" required autofocus>
|
139
|
-
|
149
|
+
<?php if ($error['tel'] === 'blank'): ?>
|
140
|
-
|
150
|
+
<p class="error_msg">※電話番号をご記入下さい</p>
|
151
|
+
<?php endif; ?> </div>
|
152
|
+
|
153
|
+
<div class="col-12 form-group" data-for="textarea">
|
154
|
+
<textarea name="contact" id="inputContent" rows="10" class="form-control" required><?php echo htmlspecialchars($post['contact']); ?></textarea>
|
155
|
+
<?php if ($error['contact'] === 'blank'): ?>
|
156
|
+
<p class="error_msg">※お問い合わせ内容をご記入下さい</p>
|
141
|
-
|
157
|
+
<?php endif; ?>
|
142
|
-
<?php if ($error['email'] === 'email'): ?>
|
143
|
-
<p class="error_msg">※メールアドレスを正しくご記入ください</p>
|
144
|
-
<?php endif; ?>
|
145
|
-
</div>
|
146
158
|
</div>
|
147
|
-
|
159
|
+
|
148
|
-
|
160
|
+
<div class="col-auto mbr-section-btn align-center">
|
149
|
-
<div class="row">
|
150
|
-
<div class="col-2">
|
151
|
-
|
161
|
+
<button type="submit" class="btn btn-md btn-warning display-4">確認画面へ</button>
|
152
|
-
</div>
|
153
|
-
<div class="col-2">
|
154
|
-
<p class="require_item">必須</p>
|
155
|
-
</div>
|
156
|
-
<div class="col-8">
|
157
|
-
<textarea name="contact" id="inputContent" rows="10" class="form-control" required><?php echo htmlspecialchars($post['contact']); ?></textarea>
|
158
|
-
<?php if ($error['contact'] === 'blank'): ?>
|
159
|
-
<p class="error_msg">※お問い合わせ内容をご記入下さい</p>
|
160
|
-
<?php endif; ?>
|
161
|
-
</div>
|
162
162
|
</div>
|
163
|
+
</div>
|
163
164
|
</div>
|
164
|
-
<div class="row">
|
165
|
-
<div class="col-8 offset-4">
|
166
|
-
<button type="submit">確認画面へ</button>
|
167
|
-
|
165
|
+
</div>
|
168
|
-
</div>
|
169
166
|
</form>
|
167
|
+
</div>
|
170
168
|
</div>
|
169
|
+
</div>
|
170
|
+
</section>
|
171
|
+
//フッター省略
|
172
|
+
<script src="assets/web/assets/jquery/jquery.min.js"></script>
|
173
|
+
<script src="assets/popper/popper.min.js"></script>
|
174
|
+
<script src="assets/tether/tether.min.js"></script>
|
175
|
+
<script src="assets/bootstrap/js/bootstrap.min.js"></script>
|
176
|
+
<script src="assets/smoothscroll/smooth-scroll.js"></script>
|
177
|
+
<script src="assets/viewportchecker/jquery.viewportchecker.js"></script>
|
178
|
+
<script src="assets/dropdown/js/nav-dropdown.js"></script>
|
179
|
+
<script src="assets/dropdown/js/navbar-dropdown.js"></script>
|
180
|
+
<script src="assets/touchswipe/jquery.touch-swipe.min.js"></script>
|
181
|
+
<script src="assets/formstyler/jquery.formstyler.js"></script>
|
182
|
+
<script src="assets/formstyler/jquery.formstyler.min.js"></script>
|
183
|
+
<script src="assets/datepicker/jquery.datetimepicker.full.js"></script>
|
184
|
+
<script src="assets/theme/js/script.js"></script>
|
185
|
+
<script src="assets/formoid/formoid.min.js"></script>
|
186
|
+
<div id="scrollToTop" class="scrollToTop mbr-arrow-up">
|
187
|
+
<a style="text-align: center;"><i class="mbr-arrow-up-icon mbr-arrow-up-icon-cm cm-icon cm-icon-smallarrow-up"></i></a>
|
188
|
+
</div>
|
189
|
+
<input name="animation" type="hidden">
|
171
190
|
</body>
|
172
191
|
</html>
|
173
192
|
|
193
|
+
|
174
194
|
```
|
1
クリックする「404お探しのページが見つかりませんでした」になってしまいますが、phpとして動作させます。 を追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -8,6 +8,8 @@
|
|
8
8
|
|
9
9
|
お力添えお願いします。
|
10
10
|
必要に応じgit.hubでの公開も可能です。
|
11
|
+
|
12
|
+
追加 クリックする「404お探しのページが見つかりませんでした」になってしまいますが、phpとして動作させます。
|
11
13
|
```php
|
12
14
|
<?php
|
13
15
|
session_start();
|