質問編集履歴

1

</form>の位置を変更しました。結果finish.phpに遷移はできました。しかし数量変更などがうまくいきません。最初の1アイテムに対する変更を受け付けません。2つめのアイテムからは正常な動作をし

2018/10/07 16:05

投稿

h_r
h_r

スコア18

test CHANGED
File without changes
test CHANGED
@@ -2,9 +2,11 @@
2
2
 
3
3
  ```html
4
4
 
5
- <form method="post" enctype="multipart/form-data" action="cart.php">
5
+ <h1>ショッピングカート</h1>
6
6
 
7
+ <form method="post" enctype="multipart/form-data" action="cart.php">
8
+
7
- <div class="itemlist">
9
+ <div class="itemlist">
8
10
 
9
11
  <?php foreach($rows as $value) { ?>
10
12
 
@@ -22,33 +24,31 @@
22
24
 
23
25
  <input type="hidden" name="sake_id" value="<?php print $value['sake_id']; ?>">
24
26
 
25
- <input type="hidden" name="amount" value="<?php print $value['amount']; ?>">
26
-
27
27
  <input type="submit" name="change" value="変更する">
28
28
 
29
29
  <?php } ?>
30
30
 
31
+ </form>
32
+
33
+ <p>合計¥<?php print $sum; ?></p>
34
+
31
- <?php if (!empty($rows)) {?>
35
+ <?php if (!empty($rows)) {?>
32
36
 
33
37
  <form method="post" enctype="multipart/form-data"action="finish.php">
34
-
35
- <p>合計¥<?php print $sum; ?></p>
36
38
 
37
39
  <input type="submit" name="buy" value="購入する">
38
40
 
39
41
  </form>
40
42
 
41
- <?php } else if (empty($rows)) { ?>
43
+ <?php } else if (empty($rows)) { ?>
42
44
 
43
- <p id="nonecart"><?php print '商品がありません'; ?></p>
45
+ <p id="nonecart"><?php print '商品がありません'; ?></p>
44
46
 
45
- <?php } ?>
47
+ <?php } ?>
46
48
 
47
- <p id="list"><a href="itemlist.php">商品一覧へ</a></p>
49
+ <p id="list"><a href="itemlist.php">商品一覧へ</a></p>
48
50
 
49
- </div>
51
+ </div>
50
-
51
- </form>
52
52
 
53
53
  ```
54
54