回答編集履歴
3
調整
test
CHANGED
@@ -70,7 +70,11 @@
|
|
70
70
|
|
71
71
|
</form>
|
72
72
|
|
73
|
+
```
|
73
74
|
|
75
|
+
|
76
|
+
|
77
|
+
```PHP
|
74
78
|
|
75
79
|
<?PHP
|
76
80
|
|
2
PHP部分の調整
test
CHANGED
@@ -74,7 +74,19 @@
|
|
74
74
|
|
75
75
|
<?PHP
|
76
76
|
|
77
|
+
$d=filter_input(INPUT_GET,'d', FILTER_DEFAULT , FILTER_REQUIRE_ARRAY);
|
78
|
+
|
79
|
+
foreach((array) $d as $key=>$val){
|
80
|
+
|
81
|
+
$sql="";
|
82
|
+
|
77
|
-
if(
|
83
|
+
if($val=="del") $sql="DELTE FROM テーブル WHERE 日付カラム='$key'";
|
84
|
+
|
85
|
+
if($val=="add") $sql="INSERT INTO テーブル(日付カラム) VALUES='$key'";
|
86
|
+
|
87
|
+
print $sql."<br>";//実際にはprepare処理でsqlを発行
|
88
|
+
|
89
|
+
}
|
78
90
|
|
79
91
|
?>
|
80
92
|
|
1
ソース追記
test
CHANGED
@@ -7,3 +7,75 @@
|
|
7
7
|
入力はHTMLですよね?
|
8
8
|
|
9
9
|
どういったものを想定されていますか?
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
# 追記
|
14
|
+
|
15
|
+
```HTML
|
16
|
+
|
17
|
+
<form>
|
18
|
+
|
19
|
+
<table>
|
20
|
+
|
21
|
+
<thead>
|
22
|
+
|
23
|
+
<th>日付<ht>
|
24
|
+
|
25
|
+
<th>削除</th>
|
26
|
+
|
27
|
+
<th>登録</th>
|
28
|
+
|
29
|
+
</tr>
|
30
|
+
|
31
|
+
</thead>
|
32
|
+
|
33
|
+
<tbody>
|
34
|
+
|
35
|
+
<tr>
|
36
|
+
|
37
|
+
<td>2016-02-01</td>
|
38
|
+
|
39
|
+
<td><input type="radio" name="d['2016-02-01']" value="del"></td>
|
40
|
+
|
41
|
+
<td><input type="radio" name="d['2016-02-01']" value="add"></td>
|
42
|
+
|
43
|
+
</tr>
|
44
|
+
|
45
|
+
<tr>
|
46
|
+
|
47
|
+
<td>2016-02-02</td>
|
48
|
+
|
49
|
+
<td><input type="radio" name="d['2016-02-02']" value="del"></td>
|
50
|
+
|
51
|
+
<td><input type="radio" name="d['2016-02-02']" value="add"></td>
|
52
|
+
|
53
|
+
</tr>
|
54
|
+
|
55
|
+
<tr>
|
56
|
+
|
57
|
+
<td>2016-02-03</td>
|
58
|
+
|
59
|
+
<td><input type="radio" name="d['2016-02-03']" value="del"></td>
|
60
|
+
|
61
|
+
<td><input type="radio" name="d['2016-02-03']" value="add"></td>
|
62
|
+
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
</tbody>
|
66
|
+
|
67
|
+
</table>
|
68
|
+
|
69
|
+
<input type="submit" value="go">
|
70
|
+
|
71
|
+
</form>
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
<?PHP
|
76
|
+
|
77
|
+
if(isset($_REQUEST["d"]))print_r($_REQUEST["d"]);
|
78
|
+
|
79
|
+
?>
|
80
|
+
|
81
|
+
```
|