質問編集履歴

1

やりなおし

2017/08/17 08:20

投稿

phiilo_
phiilo_

スコア85

test CHANGED
File without changes
test CHANGED
@@ -12,7 +12,7 @@
12
12
 
13
13
  **JSFiddle**
14
14
 
15
- https://jsfiddle.net/tc6tnwyx/
15
+ https://jsfiddle.net/knxuq305/
16
16
 
17
17
 
18
18
 
@@ -23,8 +23,6 @@
23
23
  <?php
24
24
 
25
25
  //DB接続済($dbh)
26
-
27
-
28
26
 
29
27
  $ID01 = "1";
30
28
 
@@ -44,9 +42,27 @@
44
42
 
45
43
 
46
44
 
45
+ $var1 = $_POST['d01'];
46
+
47
+ $var2 = $_POST['d02'];
48
+
49
+ $var3 = $_POST['d03'];
50
+
51
+ $var4 = $_POST['d04'];
52
+
53
+ $var5 = $_POST['d05'];
54
+
55
+
56
+
57
+
58
+
59
+
60
+
61
+
62
+
47
63
  //1行目の値をアプデ
48
64
 
49
- $sql = "UPDATE `テーブル` SET `$NAME1` = '999', `$NAME2` = '888', `$NAME3` = '777', `$NAME4` = '666', WHERE ID = '$ID01'";
65
+ $sql = "UPDATE `テーブル` SET `$NAME1` = '$var1', `$NAME2` = '$var2', `$NAME3` = '$var3', `$NAME4` = '$var4', WHERE ID = '$ID01'";
50
66
 
51
67
  $stmt = $dbh -> prepare( $sql );
52
68
 
@@ -55,6 +71,96 @@
55
71
 
56
72
 
57
73
  ?>
74
+
75
+
76
+
77
+ <html>
78
+
79
+ <form action="" method="post" >
80
+
81
+ <table>
82
+
83
+ <tbody>
84
+
85
+
86
+
87
+ <tr>
88
+
89
+ <td>ID</td>
90
+
91
+ <td>ごりら</td>
92
+
93
+ <td>らっぱ</td>
94
+
95
+ <td>ぱんだ</td>
96
+
97
+ <td>だんご</td>
98
+
99
+ </tr>
100
+
101
+
102
+
103
+ <tr>
104
+
105
+ <td>1</td>
106
+
107
+ <td><input type="text" name="d01" value="452"></td>
108
+
109
+ <td><input type="text" name="d02" value="545"></td>
110
+
111
+ <td><input type="text" name="d03" value="452"></td>
112
+
113
+ <td><input type="text" name="d04" value="245"></td>
114
+
115
+ </tr>
116
+
117
+
118
+
119
+ <tr>
120
+
121
+ <td>2</td>
122
+
123
+ <td><input type="text" name="d05" value="842"></td>
124
+
125
+ <td><input type="text" name="d06" value="585"></td>
126
+
127
+ <td><input type="text" name="d07" value="882"></td>
128
+
129
+ <td><input type="text" name="d08" value="335"></td>
130
+
131
+ </tr>
132
+
133
+
134
+
135
+ <tr>
136
+
137
+ <td>3</td>
138
+
139
+ <td><input type="text" name="d09" value="452"></td>
140
+
141
+ <td><input type="text" name="d10" value="545"></td>
142
+
143
+ <td><input type="text" name="d11" value="452"></td>
144
+
145
+ <td><input type="text" name="d12" value="245"></td>
146
+
147
+ </tr>
148
+
149
+
150
+
151
+ </tbody>
152
+
153
+ </table>
154
+
155
+
156
+
157
+ <center><input type="submit" value="UPD"></center>
158
+
159
+ </form>
160
+
161
+ </html>
162
+
163
+
58
164
 
59
165
  ```
60
166