简体   繁体   中英

How to hide the value in table and anchor tag when user click the anchor return

I want to hide the row when the admin click the anchor return because It's already saved in return.php so just need hide the returned status while the pending is not. Thank you for helping me

  <thead>
                                <tr>
                                    <th>Book title</th>                                 
                                    <th>Borrower</th>                                 
                                    <th>Type</th>                                 
                                    <th>Date Borrow</th>                                 
                                    <th>Due Date</th>                            
                                    <th>Date Returned</th>
                                    <th>Fines</th>
                                    <th>Borrow Status</th>
                                </tr>
                            </thead>
                            <tbody>

                              <?php  $user_query=mysqli_query($dbcon,"select * from borrow
                            LEFT JOIN member ON borrow.member_id = member.member_id
                            LEFT JOIN borrowdetails ON borrow.borrow_id = borrowdetails.borrow_id
                            LEFT JOIN book on borrowdetails.book_id =  book.book_id 
                            ORDER BY borrow.borrow_id DESC
                              ")or die(mysqli_error());
                                while($row=mysqli_fetch_array($user_query)){


$currentdate = date('Y/m/d');

$start = new DateTime($returndate=$row['due_date']); 

$end = new DateTime($currentdate);  

$fines =0;

if(strtotime($currentdate) > strtotime($returndate)){


 $days= $start->diff($end, true)->days;
$fines = $days > 0 ? intval(floor($days)) * 10 : 0;
$fi = $row['borrow_details_id'];
mysqli_query($dbcon,"update borrowdetails set fines='$fines' where borrow_details_id = '$fi'");
}

                                $id=$row['borrow_id'];
                                $book_id=$row['book_id'];
                                $borrow_details_id=$row['borrow_details_id'];

                                    ?>
                                <tr class="del<?php echo $id ?>">


                                <td><?php echo $row['book_title']; ?></td>
                                <td><?php echo $row['firstname']." ".$row['lastname']; ?></td>
                                <td><?php echo $row['type']; ?></td>
                                <td><?php echo $row['date_borrow']; ?></td> 
                                <td><?php echo $row['due_date']; ?> </td>
                                <td><?php echo $row['date_return']; ?> </td>
                                 <td><?php echo "₱ ".$fines; ?></td>
                                <td><?php echo $row['borrow_status'];?></td>
                                <td> <a rel="tooltip"  title="Return" id="<?php echo $borrow_details_id; ?>"
                                 href="#delete_book<?php echo $borrow_details_id; ?>" data-toggle="modal"   
                                  class="btn btn-success"><i class="icon-check icon-large"></i>Return</a>
                                <?php include('modal_return.php'); ?>
                                <td></td> 

                                </tr>
                                <?php  }  ?>
                            </tbody>
                        </table>

This is the view_return.php where will admin see the all books pending 归还书

This is the history/transaction where the book is already return 归还书的历史

For this , you can do like below example, Add a class "test" in anchorTag or in td and by using jquery


 $('.test').click(function(){ $(this).parent().hide(); }); 
 <table> <tr> <td>Test</td> <td class="test" id="returnId1">Return</td> </tr> <tr> <td>Test2</td> <td class="test" id="returnId2">Return</td> </tr> </table> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM