回答編集履歴
1
修正
test
CHANGED
@@ -1,94 +1,56 @@
|
|
1
1
|
汎用的にやるならこんな感じ
|
2
2
|
|
3
|
+
(ちょっと見やすく書き換えました)
|
4
|
+
|
3
5
|
```PHP
|
4
6
|
|
5
7
|
<?php
|
6
8
|
|
9
|
+
|
10
|
+
|
11
|
+
$text=[];
|
12
|
+
|
13
|
+
$h=[];
|
14
|
+
|
15
|
+
$checked=[];
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
$list=["date","student_num","student_name","student_teacher","symptom",
|
20
|
+
|
21
|
+
"symptom_time","symptom_cause","taiou","symptom_fix","memo",
|
22
|
+
|
23
|
+
"symptom_type","entry_time","exit_time","staff"
|
24
|
+
|
25
|
+
];
|
26
|
+
|
27
|
+
|
28
|
+
|
7
|
-
f
|
29
|
+
foreach($list as $val){
|
30
|
+
|
8
|
-
|
31
|
+
$text[$val]=filter_input(INPUT_POST,$val);
|
32
|
+
|
9
|
-
|
33
|
+
$h[$val]=htmlspecialchars($text[$val]);
|
10
34
|
|
11
35
|
}
|
12
36
|
|
13
37
|
|
14
38
|
|
15
|
-
$
|
39
|
+
$checked=[
|
16
|
-
|
17
|
-
|
40
|
+
|
18
|
-
|
19
|
-
$text["date"]=h($date);
|
20
|
-
|
21
|
-
$student_num = filter_input(INPUT_POST,'student_num');
|
22
|
-
|
23
|
-
$text["student_num"]=h($student_num);
|
24
|
-
|
25
|
-
$student_name = filter_input(INPUT_POST,'student_name');
|
26
|
-
|
27
|
-
$text["student_name"]=h($student_name);
|
28
|
-
|
29
|
-
$student_teacher = filter_input(INPUT_POST,'student_teacher');
|
30
|
-
|
31
|
-
$text["student_teacher"]=h($student_teacher);
|
32
|
-
|
33
|
-
$symptom = filter_input(INPUT_POST,'symptom');
|
34
|
-
|
35
|
-
$text["symptom"]=h($symptom);
|
36
|
-
|
37
|
-
$symptom_time = filter_input(INPUT_POST,'symptom_time');
|
38
|
-
|
39
|
-
$text["symptom_time"]=h($symptom_time);
|
40
|
-
|
41
|
-
$symptom_cause = filter_input(INPUT_POST,'symptom_cause');
|
42
|
-
|
43
|
-
$text["symptom_cause"]=h($symptom_cause);
|
44
|
-
|
45
|
-
$taiou = filter_input(INPUT_POST,'taiou');
|
46
|
-
|
47
|
-
$text["taiou"]=h($taiou);
|
48
|
-
|
49
|
-
$symptom_fix = filter_input(INPUT_POST,'symptom_fix');
|
50
|
-
|
51
|
-
$text["symptom_fix"]=h($symptom_fix);
|
52
|
-
|
53
|
-
$memo = filter_input(INPUT_POST,'memo');
|
54
|
-
|
55
|
-
$text["memo"]=h($memo);
|
56
|
-
|
57
|
-
$symptom_type = filter_input(INPUT_POST,'symptom_type');
|
58
|
-
|
59
|
-
$text["symptom_type"]=h($symptom_type);
|
60
|
-
|
61
|
-
$entry_time = filter_input(INPUT_POST,'entry_time');
|
62
|
-
|
63
|
-
$text["entry_time"]=h($entry_time);
|
64
|
-
|
65
|
-
$exit_time = filter_input(INPUT_POST,'exit_time');
|
66
|
-
|
67
|
-
$text["exit_time"]=h($exit_time);
|
68
|
-
|
69
|
-
$staff = filter_input(INPUT_POST,'staff');
|
70
|
-
|
71
|
-
$text["staff"]=h($staff);
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
41
|
+
"gender"=>[1=>"",2=>""],
|
76
|
-
|
77
|
-
|
42
|
+
|
78
|
-
|
79
|
-
$checked["gender"][$gender]=" checked";
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
43
|
+
"symptom_type"=>["外科"=>"","内科"=>"","その他"=>""],
|
44
|
+
|
84
|
-
|
45
|
+
];
|
46
|
+
|
47
|
+
|
48
|
+
|
85
|
-
|
49
|
+
foreach(array_keys($checked) as $val){
|
86
|
-
|
50
|
+
|
87
|
-
$checked[
|
51
|
+
$checked[$val][filter_input(INPUT_POST,$val)]=" checked";
|
52
|
+
|
88
|
-
|
53
|
+
}
|
89
|
-
|
90
|
-
|
91
|
-
|
92
54
|
|
93
55
|
|
94
56
|
|
@@ -104,7 +66,7 @@
|
|
104
66
|
|
105
67
|
<th>日付:</th>
|
106
68
|
|
107
|
-
<td><input type="date" id="today" name="date" value="{$
|
69
|
+
<td><input type="date" id="today" name="date" value="{$h["date"]}"></td>
|
108
70
|
|
109
71
|
</tr>
|
110
72
|
|
@@ -112,7 +74,7 @@
|
|
112
74
|
|
113
75
|
<th>入室時間:</th>
|
114
76
|
|
115
|
-
<td><input type="time" id="time" name="entry_time" value="{$
|
77
|
+
<td><input type="time" id="time" name="entry_time" value="{$h["entry_time"]}"></td>
|
116
78
|
|
117
79
|
</tr>
|
118
80
|
|
@@ -120,7 +82,7 @@
|
|
120
82
|
|
121
83
|
<th>退出時間:</th>
|
122
84
|
|
123
|
-
<td><input type="time" id="time" name="exit_time" value="{$
|
85
|
+
<td><input type="time" id="time" name="exit_time" value="{$h["exit_time"]}"></td>
|
124
86
|
|
125
87
|
</tr>
|
126
88
|
|
@@ -128,7 +90,7 @@
|
|
128
90
|
|
129
91
|
<th>学籍番号:</th>
|
130
92
|
|
131
|
-
<td><input type="text" name="student_num" placeholder="16XX0101" value="{$
|
93
|
+
<td><input type="text" name="student_num" placeholder="16XX0101" value="{$h["student_num"]}"></td>
|
132
94
|
|
133
95
|
</tr>
|
134
96
|
|
@@ -136,7 +98,7 @@
|
|
136
98
|
|
137
99
|
<th>氏名:</th>
|
138
100
|
|
139
|
-
<td><input type="text" name="student_name" placeholder="電子太郎" value="{$
|
101
|
+
<td><input type="text" name="student_name" placeholder="電子太郎" value="{$h["student_name"]}"></td>
|
140
102
|
|
141
103
|
</tr>
|
142
104
|
|
@@ -160,7 +122,7 @@
|
|
160
122
|
|
161
123
|
<th>担任:</th>
|
162
124
|
|
163
|
-
<td><input type="text" name="student_teacher" value="{$
|
125
|
+
<td><input type="text" name="student_teacher" value="{$h["student_teacher"]}"></td>
|
164
126
|
|
165
127
|
</tr>
|
166
128
|
|
@@ -168,7 +130,7 @@
|
|
168
130
|
|
169
131
|
<th>症状:</th>
|
170
132
|
|
171
|
-
<td><input type="text" name="symptom" value="{$
|
133
|
+
<td><input type="text" name="symptom" value="{$h["symptom"]}"></td>
|
172
134
|
|
173
135
|
</tr>
|
174
136
|
|
@@ -176,7 +138,7 @@
|
|
176
138
|
|
177
139
|
<th>いつから:</th>
|
178
140
|
|
179
|
-
<td><input type="text" name="symptom_time" value="{$
|
141
|
+
<td><input type="text" name="symptom_time" value="{$h["symptom_time"]}"></td>
|
180
142
|
|
181
143
|
</tr>
|
182
144
|
|
@@ -184,7 +146,7 @@
|
|
184
146
|
|
185
147
|
<th>原因は?:</th>
|
186
148
|
|
187
|
-
<td><input type="text" name="symptom_cause" value="{$
|
149
|
+
<td><input type="text" name="symptom_cause" value="{$h["symptom_cause"]}"></td>
|
188
150
|
|
189
151
|
</tr>
|
190
152
|
|
@@ -192,7 +154,7 @@
|
|
192
154
|
|
193
155
|
<th>対応:</th>
|
194
156
|
|
195
|
-
<td><input type="text" name="taiou" value="{$
|
157
|
+
<td><input type="text" name="taiou" value="{$h["taiou"]}"></td>
|
196
158
|
|
197
159
|
</tr>
|
198
160
|
|
@@ -200,7 +162,7 @@
|
|
200
162
|
|
201
163
|
<th>処置:</th>
|
202
164
|
|
203
|
-
<td><input type="text" name="symptom_fix" value="{$
|
165
|
+
<td><input type="text" name="symptom_fix" value="{$h["symptom_fix"]}"></td>
|
204
166
|
|
205
167
|
</tr>
|
206
168
|
|
@@ -224,7 +186,7 @@
|
|
224
186
|
|
225
187
|
<th>メモ:</th>
|
226
188
|
|
227
|
-
<td><textarea name="memo">{$
|
189
|
+
<td><textarea name="memo">{$h["memo"]}</textarea></td>
|
228
190
|
|
229
191
|
</tr>
|
230
192
|
|
@@ -232,7 +194,7 @@
|
|
232
194
|
|
233
195
|
<th>対応者:</th>
|
234
196
|
|
235
|
-
<td><input type="text" name="staff" value="{$
|
197
|
+
<td><input type="text" name="staff" value="{$h["staff"]}"></td>
|
236
198
|
|
237
199
|
</tr>
|
238
200
|
|
@@ -250,6 +212,4 @@
|
|
250
212
|
|
251
213
|
eof;
|
252
214
|
|
253
|
-
?>
|
254
|
-
|
255
215
|
```
|