質問編集履歴
1
mondai_touroku.phpのスクリプトの修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -132,13 +132,139 @@
|
|
132
132
|
|
133
133
|
|
134
134
|
|
135
|
+
|
136
|
+
|
137
|
+
<form method="post" action="register_already.php">
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
<div class = "col-mt-4 mb-2">
|
142
|
+
|
143
|
+
■もんだい
|
144
|
+
|
145
|
+
</div>
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
<table class="table table-bordered" style="table-layout:fixed;">
|
150
|
+
|
151
|
+
<tr>
|
152
|
+
|
153
|
+
<td class="align-middle" align = left >
|
154
|
+
|
155
|
+
<label for="mondai">もんだいを入力してください</label>
|
156
|
+
|
157
|
+
<textarea class="form-control" name="mondai" placeholder="2行で入力しましょう(1行=15文字程度)"></textarea>
|
158
|
+
|
159
|
+
</td>
|
160
|
+
|
161
|
+
</tr>
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
</table>
|
166
|
+
|
167
|
+
</form>
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
172
|
+
|
173
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
|
174
|
+
|
175
|
+
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.2/js/bootstrap.min.js" integrity="sha384-o+RDsa0aLu++PJvFqy8fFScvbHFLtbvScb8AjopnFD+iEQ7wo/CG0xlczd+2O/em" crossorigin="anonymous"></script>
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
</body>
|
182
|
+
|
183
|
+
</html>
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
```
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
mondai_hyouji.phpファイルに、以下のコードを書いています。
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
```ここに言語を入力
|
198
|
+
|
199
|
+
<!DOCTYPE html>
|
200
|
+
|
201
|
+
<html lang="ja">
|
202
|
+
|
203
|
+
<head>
|
204
|
+
|
205
|
+
<meta charset="UTF-8">
|
206
|
+
|
207
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
208
|
+
|
209
|
+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
210
|
+
|
211
|
+
<title>サンプル</title>
|
212
|
+
|
213
|
+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
|
214
|
+
|
215
|
+
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.1.4.min.js"></script>
|
216
|
+
|
217
|
+
<script src="tr_background_color.js"></script>
|
218
|
+
|
219
|
+
</head>
|
220
|
+
|
221
|
+
<body>
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
<div class="container">
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
<!-- データベースの情報をSELECTする -->
|
230
|
+
|
135
231
|
<?php
|
136
232
|
|
137
233
|
|
138
234
|
|
235
|
+
require_once('config.php');
|
236
|
+
|
237
|
+
$dsn = 'mysql:host=' . $config['host'] . '; dbname=' . $config['database'] . '; charset=utf8';
|
238
|
+
|
239
|
+
$user = $config['user'];
|
240
|
+
|
241
|
+
$password = $config['password'];
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
try{
|
246
|
+
|
247
|
+
$dbh = new PDO($dsn, $user, $password);
|
248
|
+
|
249
|
+
$sql = " SELECT * FROM mondai ORDER BY RAND() LIMIT 1 ";
|
250
|
+
|
251
|
+
$stmt = $dbh->prepare($sql);
|
252
|
+
|
253
|
+
$stmt->execute();
|
254
|
+
|
255
|
+
$data = $stmt->fetch();
|
256
|
+
|
257
|
+
}catch(PDOException $e){
|
258
|
+
|
259
|
+
echo $e->getMessage();
|
260
|
+
|
261
|
+
exit;
|
262
|
+
|
263
|
+
}
|
264
|
+
|
265
|
+
|
266
|
+
|
139
|
-
$
|
267
|
+
$no = ($data['no']);
|
140
|
-
|
141
|
-
|
142
268
|
|
143
269
|
|
144
270
|
|
@@ -146,17 +272,29 @@
|
|
146
272
|
|
147
273
|
|
148
274
|
|
149
|
-
|
150
|
-
|
151
|
-
<form method="post" action="
|
275
|
+
<form method="post" action="mondai_hyouji2.php?no=<?php echo $no; ?>">
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
|
280
|
+
|
152
|
-
|
281
|
+
<?php
|
282
|
+
|
153
|
-
|
283
|
+
$no = 1;
|
284
|
+
|
154
|
-
|
285
|
+
if(!empty($_GET['no'])){
|
286
|
+
|
287
|
+
$no = $_GET['no'];
|
288
|
+
|
289
|
+
}
|
290
|
+
|
291
|
+
|
292
|
+
|
155
|
-
|
293
|
+
$mondai = ($data['mondai']);
|
156
|
-
|
294
|
+
|
295
|
+
|
296
|
+
|
157
|
-
|
297
|
+
?>
|
158
|
-
|
159
|
-
</div>
|
160
298
|
|
161
299
|
|
162
300
|
|
@@ -164,20 +302,18 @@
|
|
164
302
|
|
165
303
|
<tr>
|
166
304
|
|
167
|
-
<td class="align-middle" align =
|
305
|
+
<td class="align-middle" align = center >
|
168
|
-
|
306
|
+
|
169
|
-
<l
|
307
|
+
<h5><?php echo nl2br($mondai) ; ?></h5>
|
170
|
-
|
171
|
-
<textarea class="form-control" name="mondai" placeholder="2行で入力しましょう(1行=15文字程度)"></textarea>
|
172
308
|
|
173
309
|
</td>
|
174
310
|
|
175
311
|
</tr>
|
176
312
|
|
177
|
-
|
178
|
-
|
179
313
|
</table>
|
180
314
|
|
315
|
+
|
316
|
+
|
181
317
|
</form>
|
182
318
|
|
183
319
|
|
@@ -199,153 +335,3 @@
|
|
199
335
|
|
200
336
|
|
201
337
|
```
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
mondai_hyouji.phpファイルに、以下のコードを書いています。
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
```ここに言語を入力
|
212
|
-
|
213
|
-
<!DOCTYPE html>
|
214
|
-
|
215
|
-
<html lang="ja">
|
216
|
-
|
217
|
-
<head>
|
218
|
-
|
219
|
-
<meta charset="UTF-8">
|
220
|
-
|
221
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
222
|
-
|
223
|
-
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
224
|
-
|
225
|
-
<title>サンプル</title>
|
226
|
-
|
227
|
-
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
|
228
|
-
|
229
|
-
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.1.4.min.js"></script>
|
230
|
-
|
231
|
-
<script src="tr_background_color.js"></script>
|
232
|
-
|
233
|
-
</head>
|
234
|
-
|
235
|
-
<body>
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
<div class="container">
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
<!-- データベースの情報をSELECTする -->
|
244
|
-
|
245
|
-
<?php
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
require_once('config.php');
|
250
|
-
|
251
|
-
$dsn = 'mysql:host=' . $config['host'] . '; dbname=' . $config['database'] . '; charset=utf8';
|
252
|
-
|
253
|
-
$user = $config['user'];
|
254
|
-
|
255
|
-
$password = $config['password'];
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
try{
|
260
|
-
|
261
|
-
$dbh = new PDO($dsn, $user, $password);
|
262
|
-
|
263
|
-
$sql = " SELECT * FROM mondai ORDER BY RAND() LIMIT 1 ";
|
264
|
-
|
265
|
-
$stmt = $dbh->prepare($sql);
|
266
|
-
|
267
|
-
$stmt->execute();
|
268
|
-
|
269
|
-
$data = $stmt->fetch();
|
270
|
-
|
271
|
-
}catch(PDOException $e){
|
272
|
-
|
273
|
-
echo $e->getMessage();
|
274
|
-
|
275
|
-
exit;
|
276
|
-
|
277
|
-
}
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
$no = ($data['no']);
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
?>
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
<form method="post" action="mondai_hyouji2.php?no=<?php echo $no; ?>">
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
<?php
|
296
|
-
|
297
|
-
$no = 1;
|
298
|
-
|
299
|
-
if(!empty($_GET['no'])){
|
300
|
-
|
301
|
-
$no = $_GET['no'];
|
302
|
-
|
303
|
-
}
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
$mondai = ($data['mondai']);
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
?>
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
<table class="table table-bordered" style="table-layout:fixed;">
|
316
|
-
|
317
|
-
<tr>
|
318
|
-
|
319
|
-
<td class="align-middle" align = center >
|
320
|
-
|
321
|
-
<h5><?php echo nl2br($mondai) ; ?></h5>
|
322
|
-
|
323
|
-
</td>
|
324
|
-
|
325
|
-
</tr>
|
326
|
-
|
327
|
-
</table>
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
</form>
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
336
|
-
|
337
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
|
338
|
-
|
339
|
-
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.2/js/bootstrap.min.js" integrity="sha384-o+RDsa0aLu++PJvFqy8fFScvbHFLtbvScb8AjopnFD+iEQ7wo/CG0xlczd+2O/em" crossorigin="anonymous"></script>
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
</body>
|
346
|
-
|
347
|
-
</html>
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
```
|