ok
Direktori : /home/ngwcolle/public_html/LIBRARY-NGWC/admin/ |
Current File : //home/ngwcolle/public_html/LIBRARY-NGWC/admin/edit-book.php |
<?php session_start(); //DB conncetion include_once('includes/config.php'); //validating Session if (strlen($_SESSION['aid']==0)) { header('location:logout.php'); } else{ if($_GET['requestid']){ $rid=$_GET['requestid']; } //Code for assign request if(isset($_POST['update'])) { $rid=$_GET['requestid']; $booktitle=mysqli_real_escape_string($con,$_POST['booktitle']); $auth1=mysqli_real_escape_string($con,$_POST['auth1']); $auth2=$_POST['auth2']; $auth3=$_POST['auth3']; $publisher=mysqli_real_escape_string($con,$_POST['publisher']); $isbn=$_POST['isbn']; $invno=$_POST['invno']; $invdate=$_POST['invdate']; $accdate=$_POST['accdate']; $bstatus=$_POST['bstatus']; $bprice=$_POST['bprice']; // $assigntime=date('d-m-y h:m:s'); $query=mysqli_query($con, "update tbl_book set booktitle='$booktitle',publisher='$publisher',author1='$auth1', author2='$auth2',author3='$auth3',isbn='$isbn',invno='$invno',purdate='$invdate', accdate='$accdate',bookstatus='$bstatus',price='$bprice' where barcode='$rid'"); if ($query) { echo '<script>alert("Book Details Updated successfully.")</script>'; echo "<script>window.location.href ='manage-book.php'</script>"; }else{ // echo '<script>alert("Something Went Wrong. Please try again.")</script>'; } } // Code for History ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="description" content=""> <meta name="author" content=""> <title> Edit Details</title> <link rel="icon" type="image/x-icon" href="../assets/favicon.ico" /> <!-- Custom fonts for this template--> <link href="vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css"> <link href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet"> <!-- Custom styles for this template--> <link href="css/sb-admin-2.min.css" rel="stylesheet"> <style type="text/css"> label{ font-size:16px; font-weight:bold; color:#000; } </style> </head> <body id="page-top"> <!-- Page Wrapper --> <div id="wrapper"> <?php include_once('includes/sidebar.php');?> <!-- Content Wrapper --> <div id="content-wrapper" class="d-flex flex-column"> <!-- Main Content --> <div id="content"> <!-- Topbar --> <?php include_once('includes/topbar.php');?> <!-- End of Topbar --> <!-- Begin Page Content --> <div class="container-fluid"> <!-- Page Heading --> <h1 class="h3 mb-4 text-gray-800">Edit Book Details</h1> <form method="post" name="adminprofile" > <div class="row"> <div class="col-lg-6"> <!-- Basic Card Example --> <div class="card shadow mb-4"> <div class="card-header py-3"> <h6 class="m-0 font-weight-bold text-primary">Book Information (Entry by)</h6> </div> <div class="card-body"> <?php // $rid=$_GET['requestid']; $query=mysqli_query($con,"select tbl_book.*,tbl_department.* from tbl_book inner join tbl_department on tbl_book.subject=tbl_department.id where tbl_book.barcode='$rid'"); while($row=mysqli_fetch_array($query)){ ?> <table class="table table-bordered" width="100%" cellspacing="0"> <tr> <th>Name</th> <td> <input type="text" name="booktitle" class="form-control" value="<?php echo $row['booktitle'];?>"> </td> </tr> <tr> <th>Author1</th> <td> <input type="text" name="auth1" class="form-control" value="<?php echo $row['author1'];?>"> </td> </tr> <tr> <th>Author2</th> <td><input type="text" name="auth2" class="form-control" value="<?php echo $row['author2'];?>"></td> </tr> <tr> <th>Author3</th> <td><input type="text" name="auth3" class="form-control" value="<?php echo $row['author3'];?>"></td> </tr> <tr> <th>Publisher</th> <td> <input type="text" name="publisher" class="form-control" value="<?php echo $row['publisher'];?>"> </td> </tr> <tr> <th>ISBN</th> <td> <input type="text" name="isbn" class="form-control" value="<?php echo $row['isbn'];?>"> </td> </tr> <tr> <th>Subject</th> <td><?php echo $row['name'];?></td> </tr> <tr> <th>Status</th> <td><?php echo $row['pstatus'];?></td> </tr> </tr> </table> <div class="form-group"> <button type="submit" class="btn btn-success btn-sm" name="update">UPDATE BOOK</button> <!-- <button type="button" class="btn btn-danger btn-sm" name="update">CANCEL</button> --> <a href="manage-book.php" class="btn btn-danger btn-sm">CANCEL</a> </div> </div> </div> </div> <div class="col-lg-6"> <!-- Basic Card Example --> <div class="card shadow mb-4"> <div class="card-header py-3"> <h6 class="m-0 font-weight-bold text-primary">Accession Details</h6> </div> <div class="card-body"> <table class="table table-bordered" width="100%" cellspacing="0"> <tr> <th>Price of the Book(INR)</th> <td> <input type="text" name="bprice" class="form-control" value="<?php echo $row['price'];?>"> </tr> <tr> <th>Invoice No./Purchase Date</th> <td> <input type="text" name="invno" class="form-control" value="<?php echo $row['invno'];?>"> <input type="date" name="invdate" class="form-control" value="<?php echo $row['purdate'];?>"> </tr> <tr> <th>Accession Date</th> <td> <input type="date" name="accdate" class="form-control" value="<?php echo $row['accdate'];?>"> </td> </tr> <tr> <th>Physical Status.</th> <td> <select name="bstatus" id="" class="form-control" required> <option value="New" <?php if ($row['bookstatus'] == 'New') echo ' selected="selected"'; ?>>New</option> <option value="Old" <?php if ($row['bookstatus'] == 'Old') echo ' selected="selected"'; ?>>Old</option> <option value="Missing" <?php if ($row['bookstatus'] == 'Missing') echo ' selected="selected"'; ?>>Missing</option> <option value="Damaged" <?php if ($row['bookstatus'] == 'Damaged') echo ' selected="selected"'; ?>>Damaged</option> <option value="Replacement" <?php if ($row['bookstatus'] == 'Replacement') echo ' selected="selected"'; ?>>Replacement</option> <option value="Hardbound" <?php if ($row['bookstatus'] == 'Hardbound') echo ' selected="selected"'; ?>>Hardbound</option> <option value="ILL" <?php if ($row['bookstatus'] == 'ILL') echo ' selected="selected"'; ?>>Inter Library Loan</option> </select> </td> </tr> </table> <?php }?> </div> </div> </div> </div> <!-- Test Tracking History ---> <div class="row"> <div class="col-lg-12"> <!-- Basic Card Example --> <div class="card shadow mb-4"> <div class="card-header py-3"> <h6 class="m-0 font-weight-bold text-primary" align="center">Request Track History</h6> </div> <div class="card-body"> <table class="table table-bordered " id="dataTable" width="100%" cellspacing="0"> <thead> <tr> <th>Issued To</th> <th>Issue Date</th> <th>Return Date</th> <th>Status</th> </tr> </thead> <?php $ret=mysqli_query($con,"select * from borrow_book where book_id='$rid'"); $num=mysqli_num_rows($ret); if($num>0){ while($result=mysqli_fetch_array($ret)){?> <tr> <td><?php echo $result['user_id'];?></td> <td><?php echo $result['date_borrowed'];?></td> <td><?php echo $result['date_returned'];?></td> <td><?php echo $result['borrowed_status'];?></td> </tr> <?php } // End while loop?> </table> <?php //end if } else { ?> <h4 align="center" style="color:red"> No Tracking history found </h4> <?php } ?> </div> </div> </div> </div> </form> </div> <!-- /.container-fluid --> </div> <!-- End of Main Content --> <?php include_once('includes/footer.php');?> </div> <!-- End of Content Wrapper --> </div> <!-- End of Page Wrapper --> <!-- Scroll to Top Button--> <?php include_once('includes/footer2.php');?> <!-- Bootstrap core JavaScript--> <script src="vendor/jquery/jquery.min.js"></script> <script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script> <!-- Core plugin JavaScript--> <script src="vendor/jquery-easing/jquery.easing.min.js"></script> <!-- Custom scripts for all pages--> <script src="js/sb-admin-2.min.js"></script> <script src="vendor/datatables/jquery.dataTables.min.js"></script> <script src="vendor/datatables/dataTables.bootstrap4.min.js"></script> <!-- Page level custom scripts --> <script src="js/demo/datatables-demo.js"></script> </body> </html> <?php } ?>