回答編集履歴

2

tuiki

2021/05/09 08:01

投稿

yambejp
yambejp

スコア116724

test CHANGED
@@ -11,3 +11,37 @@
11
11
  }
12
12
 
13
13
  ```
14
+
15
+ # 追記
16
+
17
+ ```PHP
18
+
19
+ <?PHP
20
+
21
+ $filter=filter_input(INPUT_POST,'filter');
22
+
23
+ $sql='SELECT * FROM tool ';
24
+
25
+ if(in_array($filter,['price','vibration','repulsion'])){
26
+
27
+ $sql.="order by `$filter` desc";
28
+
29
+ }
30
+
31
+ print $sql;
32
+
33
+ ?>
34
+
35
+ <form method="post">
36
+
37
+ <label><input type="radio" name="filter" value="price">price</label>
38
+
39
+ <label><input type="radio" name="filter" value="vibration">vibration</label>
40
+
41
+ <label><input type="radio" name="filter" value="repulsion">repulsion</label><br>
42
+
43
+ <input type="submit" value="send">
44
+
45
+ </form>
46
+
47
+ ```

1

chuosei

2021/05/09 08:01

投稿

yambejp
yambejp

スコア116724

test CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  ```php
4
4
 
5
- $filter=filter_input(INPUT_POST'filter');
5
+ $filter=filter_input(INPUT_POST,'filter');
6
6
 
7
7
  if($filter === 'vibration') {
8
8