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-student.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'])) { $admyear=$_POST['admyear']; $acayear=$_POST['acayear']; $mobno=$_POST['mobilenumber']; $dept=$_POST['dept']; $lcno=$_POST['lcno']; $stname=$_POST['stname']; $pieces=explode("|",$dept); $rn=$_POST['rn']; $mobile=$_POST['mobile']; $dob=$_POST['dob']; $email=$_POST['email']; $gender=$_POST['gender']; $patrontype=$_POST['ptype']; $password = base64_encode("12345"); $duplicate=mysqli_query($con,"select * from tbl_students where rollno='$rn' and status='1'"); if (mysqli_num_rows($duplicate)>0) { echo '<script>alert("Student Roll number already exist in the Library.")</script>'; } else{ $query=mysqli_query($con, "insert into tbl_students(rollno,stname,department,academicyear,admyear,dob,mobile,gender,email,libcardno,patrontype,password) values('$rn','$stname','$pieces[1]','$acayear','$admyear','$dob','$mobile','$gender','$email','$lcno','$patrontype','$password')"); if ($query) { // $dt = date('Y-m-d'); $query1=mysqli_query($con, "insert into tbl_libcard(rollno,libcardno,renewal1) values('$rn','$lcno',NOW())"); echo '<script>alert("Patron Created.")</script>'; echo "<script>window.location.href ='all-students.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 Student</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">Enroll New Student to Library</h1> </div> <!-- DataTales Example --> <div class="card shadow mb-4"> <div class="card-header py-3"> <h6 class="m-0 py-2 font-weight-bold text-primary">Add New Student</h6> <a href="all-students.php" class="float-right mt-0 btn btn-success"> <i class="fa fa-arrow-left" aria-hidden="true"></i> Back</a> </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 Admission Year</label> <select name="admyear" id="admyear" class="form-control" required>--select -- <option value="">--Select Admission Year--</option> <?php $starting_year =date('Y', strtotime('-3 year')); $ending_year = date('Y'); for($starting_year; $starting_year <= $ending_year; $starting_year++) { echo '<option value="'.$starting_year.'">'.$starting_year.'</option>'; // if($starting_year == date('Y')){ // echo '<option value="'.$starting_year.'" selected=selected>'.$starting_year.'</option>'; // } // else{ // echo '<option value="'.$starting_year.'">'.$starting_year.'</option>'; // } } ?> </select> <!-- <input type="text" class="form-control" id="inputFirstname" placeholder="First name"> --> </div> <div class="col-sm-6"> <label for="inputLastname">Academic Year</label> <input type="text" class="form-control" id="acayear" readonly name="acayear"placeholder="Academic Year" required> </div> </div> <div class="form-group row"> <div class="col-sm-6"> <label for="inputAddressLine1">Select Department/Section</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="inputAddressLine1" placeholder="Street Address"> --> </div> <div class="col-sm-6"> <label for="inputAddressLine2">Library Card no.</label> <input required type="text" class="form-control" id="lcno" name="lcno" placeholder="Line 2"> </div> </div> <div class="form-group row"> <div class="col-sm-6"> <label for="inputCity">Name</label> <input required type="text" class="form-control" id="inputCity" placeholder="Name of the Student" name="stname"> </div> <div class="col-sm-3"> <label for="inputState">Roll No/Employee ID</label> <input required type="text" class="form-control" id="rn" name="rn" placeholder="XX22-0000"> </div> <div class="col-sm-3"> <label for="inputState">Patron Type.</label> <select name="ptype" id="ptype" class="form-control" required> <option value="">--Select Patron Type--</option> <option value="1">Staff</option> <option value="2">Student</option> <option value="3">Alumni</option> <option value="4">Most Valuable Partner</option> </select> </div> </div> <div class="form-group row"> <div class="col-sm-6"> <label for="inputCity">Mobile No</label> <input type="number" required class="form-control" pattern="[6789][0-9]{9}" title="Please enter valid phone number" name="mobile" placeholder="Mobile no." required> </div> <div class="col-sm-6"> <label for="inputState">Date of Birth</label> <input type="date" name="dob" required class="form-control" id="inputState" placeholder="State"> </div> </div> <div class="form-group row"> <div class="col-sm-6"> <label for="inputContactNumber">Email-ID</label> <input type="email" name="email" class="form-control" id="inputContactNumber" placeholder="Contact Number"> </div> <div class="col-sm-6"> <label for="inputWebsite">Gender</label> <select name="gender" id="gender" required class="form-control" > <option value="" selected>Select Gender</option> <option value="Male">Male</option> <option value="Female">Female</option> <option value="Transgender">Transgender</option> </select> <!-- <input type="text" class="form-control" id="inputWebsite" placeholder="Website"> --> </div> </div> <button type="submit" class="btn btn-primary px-4 float-right" name="submit">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(){ $("#admyear").change(function(){ var selectedCountry = $(this).children("option:selected").val(); var finalyear=parseInt(selectedCountry)+3; $('#acayear').val(selectedCountry+"-"+finalyear); $('#dept').val(""); }); $("#dept").change(function(){ var slecteddept = $(this).children("option:selected").val(); alert(slecteddept); }); // get libcard no $("#dept").change(function(){ var secid1 = $(this).val(); var nameArr = secid1.split('|'); if($('#admyear').val()=="") { alert("Select Admission Year"); $(this).val(""); return false; } else { var clid1 = $('#admyear').val(); } $.ajax({ type:"POST", url: "ajax/getlibcardno.php", data: {secid:nameArr[0],admyear:clid1}, dataType:'json', success:function(data){ alert(data.libcardno); $('#lcno').val(data.libcardno); } }); // $("#nod").val(days); // $('#minage').val(clid); }); //libcard ends }); </script> <?php } ?>