ok
Direktori : /proc/thread-self/root/proc/self/root/home/ngwcolle/public_html/LIBRARY-NGWC/admin/ |
Current File : //proc/thread-self/root/proc/self/root/home/ngwcolle/public_html/LIBRARY-NGWC/admin/add-book.php |
<?php session_start(); //DB conncetion include_once('includes/config.php'); error_reporting(0); //validating Session if (strlen($_SESSION['aid']==0)) { header('location:logout.php'); } else{ //Code for record deletion if($_GET['teamid']){ $tid=$_GET['teamid']; mysqli_query($con,"delete from tblteams where id ='$tid'"); echo "<script>alert('Data Deleted');</script>"; echo "<script>window.location.href='manage-teams.php'</script>"; } if(isset($_POST['submit'])) { $dept=$_POST['dept']; $fund=$_POST['fund']; $bkcode=$_POST['bkcode']; $accno=$_POST['accno']; $booktitle=mysqli_real_escape_string($con,$_POST['booktitle']); $pubname=mysqli_real_escape_string($con,$_POST['pubname']); $pieces=explode("|",$dept); $auth1=mysqli_real_escape_string($con,$_POST['auth1']); $auth2=$_POST['auth2']; $auth3=$_POST['auth3']; $price=$_POST['price']; $isbn=$_POST['isbn']; $volume=$_POST['volume']; $purdate=$_POST['purdate']; $accdate=$_POST['accdate']; $invno=$_POST['invno']; $bstatus=$_POST['bstatus']; $query=mysqli_query($con, "insert into tbl_book(barcode,accno,subject,booktype,booktitle,publisher,author1,author2,author3,price,isbn,volume,purdate,accdate,bookstatus,invno) values('$bkcode','$accno','$pieces[1]','$fund','$booktitle','$pubname','$auth1','$auth2','$auth3','$price','$isbn','$volume','$purdate','$accdate','$bstatus','$invno')"); if ($query) { // $dt = date('Y-m-d'); echo '<script>alert("New Book Added to Library Created.")</script>'; echo "<script>window.location.href ='manage-book.php'</script>"; }else{ echo '<script>alert("Something Went Wrong. Please try again.")</script>'; } } ?> <!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>Add New Book to Library</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"> <!-- Custom styles for this page --> <link href="vendor/datatables/dataTables.bootstrap4.min.css" rel="stylesheet"> </head> <body id="page-top"> <!-- Page Wrapper --> <div id="wrapper"> <!-- Sidebar --> <?php include_once('includes/sidebar.php');?> <!-- End of Sidebar --> <!-- 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 --> <div class="d-sm-flex align-items-center justify-content-between mb-4"> <h1 class="h3 mb-0 text-gray-800">Add New Book to Library</h1> </div> <!-- DataTales Example --> <div class="card shadow mb-4"> <div class="card-header py-3"> <div class="float-left"> <h6 class="m-0 py-2 font-weight-bold text-primary">Add New Book to Library</h6></div> <div class="float-right"><a href="manage-book.php" class="float-right mt-0 btn btn-success"> <i class="fa fa-arrow-left" aria-hidden="true"></i></a></div> </div> <div class="card-body"> <div class="container py-5"> <div class="row"> <div class="col-md-10 mx-auto"> <form method="post" action=""> <div class="form-group row"> <div class="col-sm-6"> <label for="inputFirstname">Select Department</label> <select name="dept" id="dept" class="form-control" required> <option value="">--Select Department--</option> <?php $sqli = "SELECT * FROM tbl_department"; $result = mysqli_query($con, $sqli); while ($row = mysqli_fetch_array($result)) { echo '<option value="'.$row['shortcode']."|".$row['id'].'">'.$row['name'].'</option>'; } ?> </select> <!-- <input type="text" class="form-control" id="inputFirstname" placeholder="First name"> --> </div> <div class="col-sm-6"> <label for="inputLastname">Book Received From</label> <select name="fund" id="fund" class="form-control" disabled> <option value="">--Select Source of Book--</option> <option value="N">New Purchase</option> <option value="SP">Specimen/Donation</option> </select> </div> </div> <div class="form-group row"> <div class="col-sm-6"> <label for="inputAddressLine1">Book Barcode</label> <input onkeypress="return false;" required type="text" class="form-control" id="bkcode" placeholder="BArcode/Sl No." name="bkcode"> </div> <div class="col-sm-6"> <label for="inputAddressLine2">Accession no.</label> <input required onkeypress="return false;" type="text" class="form-control" id="accno" placeholder="Accession No" name="accno"> </div> </div> <div class="form-group row"> <div class="col-sm-6"> <label for="inputAddressLine1">Book Title/Name</label> <input type="text" class="form-control" name="booktitle" id="inputAddressLine1" placeholder="Title of the Book."> </div> <div class="col-sm-6"> <label for="inputAddressLine2">Publisher Name</label> <input required type="text" class="form-control" id="pubname" name="pubname" placeholder="Publisher Name"> </div> </div> <div class="form-group row"> <div class="col-sm-6"> <label for="inputCity">Author-1</label> <input required type="text" class="form-control" name="auth1" id="inputCity" placeholder="Name of the Author-1" name="auth1"> </div> <div class="col-sm-6"> <label for="inputState">Author-2</label> <input type="text" class="form-control" id="auth2" name="auth2" placeholder="Name of the Author"> </div> </div> <div class="form-group row"> <div class="col-sm-6"> <label for="inputCity">Author-3</label> <input type="text" class="form-control" name="auth3" placeholder="Name of the Author."> </div> <div class="col-sm-6"> <label for="inputState">Price of the Book</label> <input type="number" name="price" required class="form-control" id="inputState" placeholder="Price/Value"> </div> </div> <div class="form-group row"> <div class="col-sm-6"> <label for="inputContactNumber">ISBN No.</label> <input type="text" name="isbn" class="form-control" id="inputContactNumber" placeholder="10/12 Digit ISBN"> </div> <div class="col-sm-6"> <label for="inputWebsite">Volume/Edition/Year of Publication</label> <input type="text" class="form-control" id="inputWebsite" name="volume" placeholder="Volume/Edition/Year of Publication"> </div> </div> <div class="form-group row"> <div class="col-sm-6"> <label for="inputContactNumber">Purchase Date.</label> <input type="date" name="purdate" class="form-control" id="invdate" placeholder="Purchase Date"> </div> <div class="col-sm-6"> <label for="inputWebsite">Accession Date</label> <input type="date" class="form-control" id="accdate" name="accdate" placeholder="Date of Accesion"> </div> </div> <div class="form-group row"> <div class="col-sm-6"> <label for="inputContactNumber">Invoice No.</label> <input type="text" name="invno" class="form-control" id="invdate" placeholder="Invoice Number"> </div> <div class="col-sm-6"> <label for="inputWebsite">Book Status</label> <select name="bstatus" id="" class="form-control" required> <option value="New">New</option> <option value="Old">Old</option> <option value="Missing">Missing</option> <option value="Damaged">Damaged</option> <option value="Replacement">Replacement</option> <option value="Hardbound">Hardbound</option> <option value="ILL">Inter Library Loan</option> </select> </div> </div> <button type="submit" class="btn btn-primary px-4 float-right bg-gradient-primary" name="submit" id="submit_form">Save</button> </form> </div> </div> </div> </div> </div> </div> <!-- /.container-fluid --> </div> <!-- End of Main Content --> <!-- Footer --> <?php include_once('includes/footer.php');?> <!-- End of Footer --> </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> <!-- Page level plugins --> <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> <script> $(document).ready(function(){ $("#dept").change(function(){ $('#fund option[value=""]').prop('selected', true); $('#bkcode').val(""); $('#accno').val(""); if ($('#dept').val()) { // do something $('#fund').attr('disabled', false); } else { // do alert("Select Subject Name"); $('#fund').attr('disabled', true); $('#fund option[value=""]').prop('selected', true); $("#dept").focus(); } }); // get libcard no $("#fund").change(function(){ var booktype = $(this).val(); var catid=$('#dept').val(); if($('#dept').val()=== ""){ alert("Select Subject Name"); return false; } $.ajax({ type:"POST", url: "ajax/getbarcode.php", data: {booktype_id:booktype,cat_id:catid}, dataType:'json', success:function(data){ $('#bkcode').val(data.barcode); $('#accno').val(data.accession); } }); // $("#nod").val(days); // $('#minage').val(clid); }); //libcard ends }); </script> <script> $(document).ready(function() { $("#submit_form").click(function(){ // $('#accno').val(); var accdate = new Date($('#accdate').val()); var invdate = new Date($('#invdate').val()); if(new Date(accdate) < new Date(invdate)) {//compare end <=, not >= //your code herealert(date); alert("Accesion date should be after invoice date"); return false; } // else // { // alert("Ok"); // } }); }); </script> <?php } ?>