質問編集履歴

2

不適切なタグの削除

2021/06/08 11:08

投稿

ranerane0101
ranerane0101

スコア70

test CHANGED
File without changes
test CHANGED
File without changes

1

ファイル追加

2021/06/08 11:08

投稿

ranerane0101
ranerane0101

スコア70

test CHANGED
File without changes
test CHANGED
@@ -100,4 +100,168 @@
100
100
 
101
101
 
102
102
 
103
+ ーーーー追記ーーーー
104
+
105
+
106
+
107
+ form.php
108
+
109
+
110
+
111
+ ```ここに言語を入力
112
+
113
+ <!DOCTYPE html>
114
+
115
+ <html lang = "ja">
116
+
117
+ <head>
118
+
119
+ <meta charset="UTF-8">
120
+
121
+ <title>入力フォーム</title>
122
+
123
+ </head>
124
+
125
+ <body>
126
+
127
+ 入力フォーム<br>
128
+
129
+
130
+
131
+ <form method="post" action="add.php">
132
+
133
+ 料理名:<input type="text" name="recipe_name" required><br>
134
+
135
+ カテゴリ:
136
+
137
+ <select name="category">
138
+
139
+ <option value="">選択してください</option>
140
+
141
+ <option value="1">和食</option>
142
+
143
+ <option value="2">中華</option>
144
+
145
+ <option value="3">洋食</option>
146
+
147
+ </select>
148
+
149
+ <br>
150
+
151
+ 難易度:
152
+
153
+ <input type="radio" name="difficulty" value="1">簡単
154
+
155
+ <input type="radio" name="difficulty" value="2" checked>普通
156
+
157
+ <input type="radio" name="difficulty" value="3">難しい
158
+
159
+ <br>
160
+
161
+ 予算:<input type="number" min="1" max="9999" name="budget">円
162
+
163
+ <br>
164
+
165
+ 作り方:
166
+
167
+ <textarea name="howto" cols="40" rows="4" maxlength="150"></textarea>
168
+
169
+ <br>
170
+
171
+ <input type="submit" value="送信">
172
+
173
+ </form>
174
+
175
+ </body>
176
+
177
+ </html>
178
+
179
+
180
+
181
+
182
+
183
+ ```
184
+
185
+ receive.php
186
+
187
+
188
+
189
+ ```ここに言語を入力
190
+
191
+ <DOCTYPE html>
192
+
193
+ <html lang="ja">
194
+
195
+ <head>
196
+
197
+ <meta charset="UTF-8">
198
+
199
+ <title>出力結果</title>
200
+
201
+ </head>
202
+
203
+ <body>
204
+
205
+ <?php
206
+
207
+ //print_r($_POST);
208
+
209
+ echo htmlspecialchars($_POST['recipe_name'],ENT_QUOTES,'UTF-8');
210
+
211
+ echo "<br>";
212
+
213
+ if($_POST['category'] === '1') echo "和食";
214
+
215
+ if($_POST['category'] === '2') echo "中華";
216
+
217
+ if($_POST['category'] === '3') echo "洋食";
218
+
219
+ echo "<br>";
220
+
221
+ if($_POST['difficulty'] === '1') {
222
+
223
+ echo "簡単";
224
+
225
+ } elseif($_POST['difficulty'] === '2'){
226
+
227
+ echo "普通";
228
+
229
+ } else{
230
+
231
+ echo "難しい";
232
+
233
+ }
234
+
235
+ echo "<br>";
236
+
237
+ if(is_numeric($_POST['budget'])){
238
+
239
+ echo number_format($_POST['budget']);
240
+
241
+ }
242
+
243
+ echo "<br>";
244
+
245
+ echo nl2br(htmlspecialchars($_POST['howto'],ENT_QUOTES,'UTF-8'));
246
+
247
+ echo "<br>";
248
+
249
+ ?>
250
+
251
+ </body>
252
+
253
+ </html>
254
+
255
+ ```
256
+
257
+
258
+
259
+ 書籍でreceive.phpはファイル一覧みたいなところで含まれてないように見えたのですが念の為解決の一助となること祈って載せておきます。
260
+
261
+
262
+
263
+
264
+
265
+
266
+
103
267
  開発環境 Windows Xammp php7.x