ok
Direktori : /proc/thread-self/root/proc/self/root/home/ngwcolle/public_html/mis/admin/ |
Current File : //proc/thread-self/root/proc/self/root/home/ngwcolle/public_html/mis/admin/edit_subject.php |
<?php include('includes/checklogin.php'); check_login(); $rid = $_GET['pid']; // error_reporting(E_ALL); if (isset($_POST['submit'])) { $cname = $_POST['cname']; $aname = $_POST['ayear']; $cage = $_POST['stuadmit']; $feed = $_POST['passout']; // $breed = $_POST['breed']; // $adetails = $_POST['details']; // $aimage = $_FILES["animalimage"]["name"]; // move_uploaded_file($_FILES["animalimage"]["tmp_name"], "images/" . $_FILES["animalimage"]["name"]); $sql = "SELECT * from tblstudents where subid='$cname' and year='$aname'"; $query = $dbh->prepare($sql); // $query->bindParam(':aid', $aid, PDO::PARAM_STR); $query->execute(); $results = $query->fetchAll(PDO::FETCH_OBJ); if ($query->rowCount() > 0) { echo "<script>alert('Student data alreadt inserted.Check for another session..');</script>"; } else{ $sql = "INSERT INTO tblstudents(subid,coursename,year,admitted,clc) VALUES(:aname,:degree,:cage,:admitted,:clc)"; $query = $dbh->prepare($sql); $query->bindParam(':aname', $cname); $query->bindParam(':degree', $rid, PDO::PARAM_STR); $query->bindParam(':cage', $aname, PDO::PARAM_STR); $query->bindParam(':admitted', $cage); $query->bindParam(':clc', $feed); // $query->bindParam(':adetails', $adetails, PDO::PARAM_STR); // $query->bindParam(':aimage', $aimage, PDO::PARAM_STR); $query->execute(); $lastInsertId = $dbh->lastInsertId(); if ($lastInsertId) { echo "<script>alert('Student data inserted successfully');</script>"; echo "<script>window.location.href = 'manage_subject.php'</script>"; } else { $error = "Something went wrong. Please try again"; } } } ?> <!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=""> <link href="img/logo/logo.png" rel="icon"> <title>Admin - Edit Subject</title> <link href="vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css"> <link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"> <link href="css/ruang-admin.min.css" rel="stylesheet"> <style> .errorWrap { padding: 10px; margin: 0 0 20px 0; background: #fff; border-left: 4px solid #dd3d36; -webkit-box-shadow: 0 1px 1px 0 rgba(0, 0, 0, .1); box-shadow: 0 1px 1px 0 rgba(0, 0, 0, .1); } .succWrap { padding: 10px; margin: 0 0 20px 0; background: #fff; border-left: 4px solid #5cb85c; -webkit-box-shadow: 0 1px 1px 0 rgba(0, 0, 0, .1); box-shadow: 0 1px 1px 0 rgba(0, 0, 0, .1); } </style> </head> <body id="page-top"> <div id="wrapper"> <!-- Sidebar --> <?php include('includes/sidebar.php'); ?> <!-- Sidebar --> <div id="content-wrapper" class="d-flex flex-column"> <div id="content"> <!-- TopBar --> <?php include('includes/header.php'); ?> <!-- Topbar --> <!-- Container Fluid--> <div class="container-fluid" id="container-wrapper"> <div class="d-sm-flex align-items-center justify-content-between mb-4"> <h1 class="h3 mb-0 text-gray-800">Course</h1> <ol class="breadcrumb"> <li class="breadcrumb-item"><a href="dashboard.php">Home</a></li> <li class="breadcrumb-item active" aria-current="page">edit Course Detail</li> </ol> </div> <div class="row"> <div class="col-lg-12"> <!-- Form Basic --> <div class="card mb-4"> <div class="card-header py-3 d-flex flex-row align-items-center justify-content-between"> <h6 class="m-0 font-weight-bold text-primary">Edit Course</h6> </div> <div class="card-body"> <?php if ($error) { ?> <div class="errorWrap"> <strong>ERROR</strong>:<?php echo htmlentities($error); ?> </div> <?php } else if ($msg) { ?> <div class="succWrap"> <strong>SUCCESS</strong>:<?php echo htmlentities($msg); ?> </div> <?php } ?> <div class="row"> <div class="col-md-8"> <div class="table-responsive p-2"> <table class="table align-items-center table-flush table-hover" id="dataTableHover"> <thead class="thead-light"> <tr> <th>No.</th> <th>Course</th> <th>Subjects</th> <th>Sanctioned Strength</th> <th>Student Admitted(Total)</th> <!-- <th>Action</th> --> </tr> </thead> <tbody> <?php // $sql = "SELECT tbl_subject.*,tbl_subject.sanstrength,sum(tblstudents.admitted) as admitted from tbl_subject inner join tblstudents on tbl_subject.id=tblstudents.subid where tbl_subject.coursename='$rid' order by id desc"; $sql = "SELECT tbl_subject.*,tbl_subject.sanstrength,sum(tblstudents.admitted) as admitted,tblstudents.subid from tbl_subject inner join tblstudents on tbl_subject.id=tblstudents.subid where tbl_subject.coursename='$rid' order by id desc"; // echo $sql; $query = $dbh->prepare($sql); $query->execute(); $results = $query->fetchAll(PDO::FETCH_OBJ); $cnt = 1; if ($query->rowCount() > 0) { foreach ($results as $result) { ?> <tr> <td><?php echo $cnt; ?></td> <td><a href="view_student.php?pid=<?php echo htmlentities($result->coursename);?>"><?php echo $result->coursename; ?></a></td> <td><?php echo $result->subject; ?></td> <td><?php echo $result->sanstrength; ?></td> <td><?php echo $result->admitted; ?></td> <!-- <td align="left" style="padding: 15px;"><a class="btn btn-sm btn-primary" style=" display: inline;"><i class="fas fa-edit"></i></a> --> </td> </tr> <?php $cnt = $cnt + 1; } } ?> </tbody> </table> </div> </div> <div class="col-md-4"> <form class="form-sample" method="post" enctype="multipart/form-data"> <div class="row"> <div class="form-group col-md-12"> <label class="col-sm-12 pl-0 pr-0">Subject Name</label> <div class="col-sm-12 pl-0 pr-0"> <select name="cname" id="" class="form-control" required> <option value="">--Select Subject--</option> <?php $smt = $dbh->prepare("select * from tbl_subject where coursename='$rid'"); $smt->execute(); $data = $smt->fetchAll(PDO::FETCH_OBJ); foreach ($data as $row) { ?> <option value="<?php echo $row->id; ?>"><?php echo strtoupper($row->subject); ?></option> <?php } ?> </select> </div> </div> </div> <div class="row"> <div class="form-group col-md-12"> <label class="col-sm-12 pl-0 pr-0">Admission Year</label> <div class="col-sm-12 pl-0 pr-0"> <select name="ayear" id="" class="form-control" required> <option value="">--Select Year--</option> <?php // get current year $curYear = date('Y'); // create range of required years and iterate over them foreach(range($curYear - 10, $curYear) as $year) { echo "<option value='$year'>$year</option>"; } ?> </select> </div> </div> </div> <div class="row"> <div class="form-group col-md-12"> <label class="col-sm-12 pl-0 pr-0">Student Admitted</label> <div class="col-sm-12 pl-0 pr-0"> <input type="number" class="form-control" name="stuadmit" id="" placeholder="Subject Name" required> </div> </div> </div> <div class="row"> <div class="form-group col-md-12"> <label class="col-sm-12 pl-0 pr-0">Students Passout/CLC</label> <div class="col-sm-12 pl-0 pr-0"> <input type="number" name="passout" class="form-control"> </div> </div> </div> <button type="submit" name="submit" class="btn-primary btn">Create</button> <button type="reset" class="btn-inverse btn">Reset</button> </form> </div> </div> </div> </div> </div> </div> <!--Row--> <!-- Modal Logout --> <?php include('includes/modal.php'); ?> </div> <!---Container Fluid--> </div> <!-- Footer --> <?php include('includes/footer.php'); ?> <!-- Footer --> </div> </div> <!-- Scroll to top --> <a class="scroll-to-top rounded" href="#page-top"> <i class="fas fa-angle-up"></i> </a> <script src="vendor/jquery/jquery.min.js"></script> <script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script> <script src="vendor/jquery-easing/jquery.easing.min.js"></script> <script src="js/ruang-admin.min.js"></script> </body> </html>