質問するログイン新規登録

質問編集履歴

2

HTMLPHPのコードが抜けていたので修正

2021/06/24 08:35

投稿

fuyukixxx
fuyukixxx

スコア26

title CHANGED
File without changes
body CHANGED
@@ -21,6 +21,14 @@
21
21
  ```
22
22
  ```HTMLPHP
23
23
  コード
24
+ <?php if ($post['user'] !== $member['user']) :?>
25
+ <?php for ($i = 0; $i < count($outLike); $i++) :?>
26
+ <?php if ($outLike[$i]['favorite_id'] === $post['id'] && $outLike[$i]['favorite'] === 'favorite') :?>
27
+ <?php $icon = 'fas fa-thumbs-up'?>
28
+ <?php $boolean = 'hoge'?>
29
+ <?php break?>
30
+ <?php endif ;?>
31
+ <?php endfor; ?>
24
32
  <?php while ($post = $posts->fetch()) : ?>
25
33
  <form id="like_form" action="" method="post">
26
34
  <span class="hidden_id" style="display: none;"><?php echo htmlspecialchars($post['id'], ENT_QUOTES)?></span>

1

javascript DOMコードを記入するのを忘れてました。

2021/06/24 08:35

投稿

fuyukixxx
fuyukixxx

スコア26

title CHANGED
File without changes
body CHANGED
@@ -47,7 +47,13 @@
47
47
  ```
48
48
  ```javascript
49
49
  コード
50
+ const likeBtn = document.querySelectorAll('.like__btn');
51
+ const hidden_id = document.querySelectorAll('.hidden_id');
52
+ const hidden_boolean = document.querySelectorAll('.hidden_boolean');
53
+ let likeIcon = document.querySelectorAll('.icon');
54
+ let clicked = null;
55
+
50
- for (let i = 0; i < likeBtn.length; i++) {
56
+ for (let i = 0; i < likeBtn.length; i++) {
51
57
  likeBtn[i].addEventListener('click', () => {
52
58
  const postForm = new FormData(document.forms.like_form);
53
59
  //カラムfavoriteだった場合true