質問編集履歴
2
ソースを修正しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -28,6 +28,10 @@
|
|
28
28
|
|
29
29
|
###該当のソースコード
|
30
30
|
|
31
|
+
<?php
|
32
|
+
|
33
|
+
|
34
|
+
|
31
35
|
$alp_array=array("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z");
|
32
36
|
|
33
37
|
|
@@ -228,90 +232,6 @@
|
|
228
232
|
|
229
233
|
</script>
|
230
234
|
|
231
|
-
<style type="text/css">
|
232
|
-
|
233
|
-
#main{
|
234
|
-
|
235
|
-
text-align: center;
|
236
|
-
|
237
|
-
}
|
238
|
-
|
239
|
-
select{
|
240
|
-
|
241
|
-
font-size: 15px;
|
242
|
-
|
243
|
-
height: 30px;
|
244
|
-
|
245
|
-
width: 90px;
|
246
|
-
|
247
|
-
}
|
248
|
-
|
249
|
-
div#table{
|
250
|
-
|
251
|
-
text-align: center;
|
252
|
-
|
253
|
-
overflow-y: scroll;
|
254
|
-
|
255
|
-
height: 400px;
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
}
|
260
|
-
|
261
|
-
table{
|
262
|
-
|
263
|
-
text-align: center;
|
264
|
-
|
265
|
-
width: 800px;
|
266
|
-
|
267
|
-
}
|
268
|
-
|
269
|
-
td{
|
270
|
-
|
271
|
-
height: 5px;
|
272
|
-
|
273
|
-
width: 30px;
|
274
|
-
|
275
|
-
}
|
276
|
-
|
277
|
-
input{
|
278
|
-
|
279
|
-
margin-left:5px;
|
280
|
-
|
281
|
-
margin-bottom:5px;
|
282
|
-
|
283
|
-
}
|
284
|
-
|
285
|
-
#serch{
|
286
|
-
|
287
|
-
height: 500px;
|
288
|
-
|
289
|
-
width: 200px;
|
290
|
-
|
291
|
-
position: fixed;
|
292
|
-
|
293
|
-
bottom: -10px;
|
294
|
-
|
295
|
-
right: 20px;
|
296
|
-
|
297
|
-
}
|
298
|
-
|
299
|
-
#add_cateproduct_div{
|
300
|
-
|
301
|
-
display: none;
|
302
|
-
|
303
|
-
}
|
304
|
-
|
305
|
-
#add_product_div{
|
306
|
-
|
307
|
-
display: block;
|
308
|
-
|
309
|
-
}
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
</style>
|
314
|
-
|
315
235
|
</head>
|
316
236
|
|
317
237
|
<body>
|
1
ソースを修正しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -28,60 +28,360 @@
|
|
28
28
|
|
29
29
|
###該当のソースコード
|
30
30
|
|
31
|
+
$alp_array=array("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z");
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
/////////セッション//////////
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
//テーブル保存用
|
40
|
+
|
41
|
+
if(isset($_SESSION['table'])){
|
42
|
+
|
43
|
+
}else{
|
44
|
+
|
45
|
+
$_SESSION['table']=null;
|
46
|
+
|
47
|
+
}
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
//ドロップダウンリスト保存用
|
52
|
+
|
53
|
+
if(isset($_SESSION['select'])){
|
54
|
+
|
55
|
+
}else{
|
56
|
+
|
57
|
+
$_SESSION['select']=null;
|
58
|
+
|
59
|
+
}
|
60
|
+
|
61
|
+
|
62
|
+
|
31
|
-
|
63
|
+
//花名保存用
|
64
|
+
|
65
|
+
if(isset($_SESSION['f_name'])){
|
66
|
+
|
67
|
+
}else{
|
68
|
+
|
69
|
+
$_SESSION['f_name']=null;
|
70
|
+
|
71
|
+
}
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
//花名保存用
|
76
|
+
|
77
|
+
if(isset($_SESSION['f_catename'])){
|
78
|
+
|
79
|
+
}else{
|
80
|
+
|
81
|
+
$_SESSION['f_catename']=null;
|
82
|
+
|
83
|
+
}
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
//セッション削除
|
90
|
+
|
91
|
+
if(isset($_POST['destroy'])){
|
92
|
+
|
93
|
+
session_destroy();
|
94
|
+
|
95
|
+
}
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
////////データベース////////
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
//PDO接続
|
104
|
+
|
105
|
+
$pdo = new PDO("mysql:dbname=flower_shop;host=localhost","root","admin");
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
//商品マスタ表示
|
110
|
+
|
111
|
+
$stmt1 = $pdo->query("select p_masta.P_code,p_masta.P_categorycode,p_codes.p_name,p_masta.p_catename from p_masta LEFT OUTER JOIN p_codes on p_masta.P_code = p_codes.P_code");
|
112
|
+
|
113
|
+
$_SESSION['table'].='<table border="1">';
|
114
|
+
|
115
|
+
$_SESSION['table'].="<tr><td>商品コード</td><td>商品種類</td><td>商品</td></tr>";
|
116
|
+
|
117
|
+
$_SESSION['table'].="</tr>";
|
118
|
+
|
119
|
+
foreach ($stmt1 as $key) {
|
120
|
+
|
121
|
+
$_SESSION['table'].="<tr>";
|
122
|
+
|
123
|
+
$_SESSION['table'].="<td>".$key['P_code'].$key['P_categorycode']."</td>";
|
124
|
+
|
125
|
+
$_SESSION['table'].="<td>".$key['p_name']."</td>";
|
126
|
+
|
127
|
+
$_SESSION['table'].="<td>".$key['p_catename']."</td>";
|
128
|
+
|
129
|
+
$_SESSION['table'].="</tr>";
|
130
|
+
|
131
|
+
}
|
132
|
+
|
133
|
+
$_SESSION['table'].='</table>';
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
//商品名のみ追加→商品コード割り振り
|
138
|
+
|
139
|
+
if(isset($_POST['flower_name'])){
|
140
|
+
|
141
|
+
$stmt2 = $pdo->query("select P_code from p_code ORDER BY P_code");
|
142
|
+
|
143
|
+
$new_Pcode=array(); //新しい商品コード、生成、取り扱い用配列
|
144
|
+
|
145
|
+
foreach ($stmt2 as $key) {
|
146
|
+
|
147
|
+
if($key['P_code']==null){
|
148
|
+
|
149
|
+
$new_Pcode = str_split($key['P_code-1']);
|
150
|
+
|
151
|
+
}
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
}
|
156
|
+
|
157
|
+
}
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
?>
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
<!DOCTYPE html>
|
32
168
|
|
33
169
|
<html>
|
34
170
|
|
35
171
|
<head>
|
36
172
|
|
37
|
-
<t
|
173
|
+
<meta charset="utf-8">
|
38
|
-
|
174
|
+
|
39
|
-
<script type="text/javascript" src="
|
175
|
+
<script type="text/javascript" src="js/jquery-3.2.1.min.js"></script>
|
40
|
-
|
176
|
+
|
41
|
-
<s
|
177
|
+
<link rel="stylesheet" type="text/css" href="css/style.css">
|
42
178
|
|
43
179
|
<script type="text/javascript">
|
44
180
|
|
45
|
-
$(
|
181
|
+
$(function(){
|
46
|
-
|
182
|
+
|
47
|
-
|
183
|
+
$('#add_product_inp').click(function(){
|
184
|
+
|
48
|
-
|
185
|
+
$('#add_cateproduct_div').css('display','none');
|
186
|
+
|
187
|
+
$('#add_product_div').css('display','block');
|
188
|
+
|
189
|
+
//td_val=$(this).text();
|
190
|
+
|
191
|
+
//$('#selected_fname').val([td_val]);
|
192
|
+
|
193
|
+
//$('#selected_form').submit();
|
194
|
+
|
195
|
+
});
|
196
|
+
|
197
|
+
$('#add_cateproduct_inp').click(function(){
|
198
|
+
|
199
|
+
$('#add_product_div').css('display','none');
|
200
|
+
|
201
|
+
$('#add_cateproduct_div').css('display','block');
|
202
|
+
|
203
|
+
//td_val=$(this).text();
|
204
|
+
|
205
|
+
//$('#selected_fname').val([td_val]);
|
206
|
+
|
207
|
+
//$('#selected_form').submit();
|
208
|
+
|
209
|
+
});
|
210
|
+
|
211
|
+
$('#cate_serch_inp').keyup(function() {
|
212
|
+
|
49
|
-
$.post( "
|
213
|
+
$.post( "masta_add.php", $(this).serialize(), function(response){
|
50
|
-
|
214
|
+
|
51
|
-
alert(response);
|
215
|
+
alert(response);
|
52
|
-
|
216
|
+
|
53
|
-
}
|
217
|
+
});
|
54
|
-
|
218
|
+
|
55
|
-
return false;
|
219
|
+
return false;
|
56
|
-
|
220
|
+
|
57
|
-
|
221
|
+
});
|
222
|
+
|
223
|
+
|
58
224
|
|
59
225
|
});
|
60
226
|
|
227
|
+
|
228
|
+
|
61
229
|
</script>
|
62
230
|
|
231
|
+
<style type="text/css">
|
232
|
+
|
233
|
+
#main{
|
234
|
+
|
235
|
+
text-align: center;
|
236
|
+
|
237
|
+
}
|
238
|
+
|
239
|
+
select{
|
240
|
+
|
241
|
+
font-size: 15px;
|
242
|
+
|
243
|
+
height: 30px;
|
244
|
+
|
245
|
+
width: 90px;
|
246
|
+
|
247
|
+
}
|
248
|
+
|
249
|
+
div#table{
|
250
|
+
|
251
|
+
text-align: center;
|
252
|
+
|
253
|
+
overflow-y: scroll;
|
254
|
+
|
255
|
+
height: 400px;
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
}
|
260
|
+
|
261
|
+
table{
|
262
|
+
|
263
|
+
text-align: center;
|
264
|
+
|
265
|
+
width: 800px;
|
266
|
+
|
267
|
+
}
|
268
|
+
|
269
|
+
td{
|
270
|
+
|
271
|
+
height: 5px;
|
272
|
+
|
273
|
+
width: 30px;
|
274
|
+
|
275
|
+
}
|
276
|
+
|
277
|
+
input{
|
278
|
+
|
279
|
+
margin-left:5px;
|
280
|
+
|
281
|
+
margin-bottom:5px;
|
282
|
+
|
283
|
+
}
|
284
|
+
|
285
|
+
#serch{
|
286
|
+
|
287
|
+
height: 500px;
|
288
|
+
|
289
|
+
width: 200px;
|
290
|
+
|
291
|
+
position: fixed;
|
292
|
+
|
293
|
+
bottom: -10px;
|
294
|
+
|
295
|
+
right: 20px;
|
296
|
+
|
297
|
+
}
|
298
|
+
|
299
|
+
#add_cateproduct_div{
|
300
|
+
|
301
|
+
display: none;
|
302
|
+
|
303
|
+
}
|
304
|
+
|
305
|
+
#add_product_div{
|
306
|
+
|
307
|
+
display: block;
|
308
|
+
|
309
|
+
}
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
</style>
|
314
|
+
|
63
315
|
</head>
|
64
316
|
|
65
317
|
<body>
|
66
318
|
|
67
|
-
<
|
319
|
+
<div id="main">
|
68
|
-
|
69
|
-
|
320
|
+
|
70
|
-
|
71
|
-
|
321
|
+
<input type="radio" name="div_change" id="add_product_inp"><a>商品の追加</a>
|
72
|
-
|
322
|
+
|
73
|
-
<i
|
323
|
+
<div id="add_product_div">
|
324
|
+
|
74
|
-
|
325
|
+
<form id="add_product_frm" action="masta_add.php" method="post">
|
326
|
+
|
327
|
+
<input name="cate_serch_inp" id="cate_serch_inp" type="text" placeholder="商品の種類を選択" autocomplete="off" required><br>
|
328
|
+
|
329
|
+
<input name="" placeholder="商品を追加" autocomplete="off" required><input id="submit" type="submit" value="追加">
|
330
|
+
|
75
|
-
</form>
|
331
|
+
</form>
|
332
|
+
|
333
|
+
</div>
|
334
|
+
|
335
|
+
<br>
|
336
|
+
|
337
|
+
<input type="radio" name="div_change" id="add_cateproduct_inp"><a>商品の種類追加</a>
|
338
|
+
|
339
|
+
<div id="add_cateproduct_div">
|
340
|
+
|
341
|
+
<form action="masta_add.php" method="post">
|
342
|
+
|
343
|
+
<input type="text" placeholder="商品の種類を追加" autocomplete="off" required><input type="submit" value="追加">
|
344
|
+
|
345
|
+
</form>
|
346
|
+
|
347
|
+
</div>
|
348
|
+
|
349
|
+
<hr>
|
350
|
+
|
351
|
+
<h1>取り扱い商品一覧</h1>
|
352
|
+
|
353
|
+
<div id="table">
|
354
|
+
|
355
|
+
<?php echo $_SESSION['table'];?>
|
356
|
+
|
357
|
+
</div>
|
358
|
+
|
359
|
+
<div id="serch">
|
360
|
+
|
361
|
+
<form method="post" action="masta_add.php">
|
362
|
+
|
363
|
+
<h4>取り扱い商品検索</h4>
|
364
|
+
|
365
|
+
<input type="checkbox" name="chk" id="chk"><a>商品名のみ検索</a><br>
|
366
|
+
|
367
|
+
<input type="checkbox" name="chk" id="chk"><a>職行</a><br>
|
368
|
+
|
369
|
+
<input type="text" placeholder="商品名" autocomplete="off" required>
|
370
|
+
|
371
|
+
<input placeholder="商品コード" autocomplete="off" required>
|
372
|
+
|
373
|
+
<input type="submit" name="" value="検索">
|
374
|
+
|
375
|
+
</form>
|
376
|
+
|
377
|
+
</div>
|
378
|
+
|
379
|
+
</div>
|
76
380
|
|
77
381
|
</body>
|
78
382
|
|
79
383
|
</html>
|
80
384
|
|
81
|
-
```
|
82
|
-
|
83
|
-
|
84
|
-
|
85
385
|
###試したこと
|
86
386
|
|
87
387
|
課題に対してアプローチしたことを記載してください
|