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

質問編集履歴

4

参考サイトの追加

2021/02/07 02:35

投稿

taizoyama
taizoyama

スコア3

title CHANGED
File without changes
body CHANGED
@@ -171,5 +171,7 @@
171
171
 
172
172
  ```
173
173
 
174
+ [参考サイト](https://into-the-program.com/laravel-create-contact-form/)
175
+
174
176
  どなたかご回答いただけないでしょうか。
175
177
  何卒よろしくお願い致します。

3

確認用のviewの追加

2021/02/07 02:35

投稿

taizoyama
taizoyama

スコア3

title CHANGED
File without changes
body CHANGED
@@ -84,7 +84,7 @@
84
84
 
85
85
  ```
86
86
 
87
- ```view
87
+ ```indexview
88
88
  <form method="POST" action="{{ route('contact.confirm') }}">
89
89
  @csrf
90
90
 
@@ -128,5 +128,48 @@
128
128
  </form>
129
129
  ```
130
130
 
131
+ ```comfirmview
132
+ <form method="POST" action="{{ route('contact.send') }}">
133
+ @csrf
134
+
135
+ <label>お名前</label>
136
+ {{ $inputs['name'] }}
137
+ <input
138
+ name="name"
139
+ value="{{ $inputs['name'] }}"
140
+ type="hidden">
141
+
142
+ <label>メールアドレス</label>
143
+ {{ $inputs['email'] }}
144
+ <input
145
+ name="email"
146
+ value="{{ $inputs['email'] }}"
147
+ type="hidden">
148
+
149
+ <label>タイトル</label>
150
+ {{ $inputs['title'] }}
151
+ <input
152
+ name="title"
153
+ value="{{ $inputs['title'] }}"
154
+ type="hidden">
155
+
156
+
157
+ <label>お問い合わせ内容</label>
158
+ {!! nl2br(e($inputs['body'])) !!}
159
+ <input
160
+ name="body"
161
+ value="{{ $inputs['body'] }}"
162
+ type="hidden">
163
+
164
+ <button type="submit" name="action" value="back">
165
+ 入力内容修正
166
+ </button>
167
+ <button type="submit" name="action" value="submit">
168
+ 送信する
169
+ </button>
170
+ </form>
171
+
172
+ ```
173
+
131
174
  どなたかご回答いただけないでしょうか。
132
175
  何卒よろしくお願い致します。

2

viewの変更

2021/02/07 02:30

投稿

taizoyama
taizoyama

スコア3

title CHANGED
File without changes
body CHANGED
@@ -85,38 +85,47 @@
85
85
  ```
86
86
 
87
87
  ```view
88
- <form method="POST" action="{{ route('contact.send') }}">
88
+ <form method="POST" action="{{ route('contact.confirm') }}">
89
- @csrf
89
+ @csrf
90
90
 
91
- <label>メールアドレス</label>
91
+ <label>お名前</label>
92
- {{ $inputs['email'] }}
93
- <input
92
+ <input
94
- name="email"
93
+ name="name"
95
- value="{{ $inputs['email'] }}"
94
+ value="{{ old('name') }}"
96
- type="hidden">
95
+ type="text">
96
+ @if ($errors->has('name'))
97
+ <p class="error-message">{{ $errors->first('name') }}</p>
98
+ @endif
97
99
 
98
- <label>タイトル</label>
100
+ <label>メーアドレス</label>
99
- {{ $inputs['title'] }}
100
- <input
101
+ <input
101
- name="title"
102
+ name="email"
102
- value="{{ $inputs['title'] }}"
103
+ value="{{ old('email') }}"
103
- type="hidden">
104
+ type="text">
105
+ @if ($errors->has('email'))
106
+ <p class="error-message">{{ $errors->first('email') }}</p>
107
+ @endif
104
108
 
109
+ <label>タイトル</label>
110
+ <input
111
+ name="title"
112
+ value="{{ old('title') }}"
113
+ type="text">
114
+ @if ($errors->has('title'))
115
+ <p class="error-message">{{ $errors->first('title') }}</p>
116
+ @endif
105
117
 
106
- <label>お問い合わせ内容</label>
107
- {!! nl2br(e($inputs['body'])) !!}
108
- <input
109
- name="body"
110
- value="{{ $inputs['body'] }}"
111
- type="hidden">
112
118
 
119
+ <label>お問い合わせ内容</label>
113
- <button type="submit" name="action" value="back">
120
+ <textarea name="body">{{ old('body') }}</textarea>
121
+ @if ($errors->has('body'))
122
+ <p class="error-message">{{ $errors->first('body') }}</p>
123
+ @endif
124
+
125
+ <button type="submit">
114
- 入力内容修正
126
+ 入力内容確認
115
- </button>
127
+ </button>
116
- <button type="submit" name="action" value="submit">
117
- 送信する
118
- </button>
119
- </form>
128
+ </form>
120
129
  ```
121
130
 
122
131
  どなたかご回答いただけないでしょうか。

1

viewのコードを間違えていました。大変申し訳ございせん。戻るボタンは入力内容修正ボタンです。

2021/02/06 14:57

投稿

taizoyama
taizoyama

スコア3

title CHANGED
File without changes
body CHANGED
@@ -85,47 +85,38 @@
85
85
  ```
86
86
 
87
87
  ```view
88
- <form method="POST" action="{{ route('contact.confirm') }}">
88
+ <form method="POST" action="{{ route('contact.send') }}">
89
- @csrf
89
+ @csrf
90
90
 
91
- <label>お名前</label>
91
+ <label>メールアドレス</label>
92
+ {{ $inputs['email'] }}
92
- <input
93
+ <input
93
- name="name"
94
+ name="email"
94
- value="{{ old('name') }}"
95
+ value="{{ $inputs['email'] }}"
95
- type="text">
96
+ type="hidden">
96
- @if ($errors->has('name'))
97
- <p class="error-message">{{ $errors->first('name') }}</p>
98
- @endif
99
97
 
100
- <label>メーアドレス</label>
98
+ <label>タイトル</label>
99
+ {{ $inputs['title'] }}
101
- <input
100
+ <input
102
- name="email"
101
+ name="title"
103
- value="{{ old('email') }}"
102
+ value="{{ $inputs['title'] }}"
104
- type="text">
103
+ type="hidden">
105
- @if ($errors->has('email'))
106
- <p class="error-message">{{ $errors->first('email') }}</p>
107
- @endif
108
104
 
109
- <label>タイトル</label>
110
- <input
111
- name="title"
112
- value="{{ old('title') }}"
113
- type="text">
114
- @if ($errors->has('title'))
115
- <p class="error-message">{{ $errors->first('title') }}</p>
116
- @endif
117
105
 
106
+ <label>お問い合わせ内容</label>
107
+ {!! nl2br(e($inputs['body'])) !!}
108
+ <input
109
+ name="body"
110
+ value="{{ $inputs['body'] }}"
111
+ type="hidden">
118
112
 
119
- <label>お問い合わせ内容</label>
120
- <textarea name="body">{{ old('body') }}</textarea>
113
+ <button type="submit" name="action" value="back">
121
- @if ($errors->has('body'))
122
- <p class="error-message">{{ $errors->first('body') }}</p>
123
- @endif
124
-
125
- <button type="submit">
126
- 入力内容確認
114
+ 入力内容修正
127
- </button>
115
+ </button>
116
+ <button type="submit" name="action" value="submit">
117
+ 送信する
118
+ </button>
128
- </form>
119
+ </form>
129
120
  ```
130
121
 
131
122
  どなたかご回答いただけないでしょうか。