<?php  
include ('../includes/connection.php');    
if (isset($_POST['add_feb'])){
$student_roll_no = $_POST['student_roll_no']; 
$class_id = $_POST['class_id']; 
$semister = $_POST['semister']; 
$marks = $_POST['marks'];  

$year=date("Y");  
$result_added_by = $_POST['result_added_by'];   
 
 $student= mysqli_query($conn,"SELECT student_roll_no FROM marks_srms WHERE student_roll_no='$student_roll_no' ")or die(mysqli_error());
$row = mysqli_fetch_array($student);
$check=$row['student_roll_no'];
if ($check!=$student_roll_no) {
  $query=mysqli_query($conn,"INSERT INTO `marks_srms`(`class_id`, `semister`, `code`, `student_roll_no`,`marks`,`grade`, `result_added_by`, `Year`) VALUES ('$class_id', '$semister','$code','$student_roll_no','$marks','$grade','$result_added_by','$year')"); 
  if($query){  
         ?>
         <script type="text/javascript">
             alert("Result Success Fully Added");
         </script>
        <?php  
      }  
      else{
        ?>  
        <script type="text/javascript">
         alert("Sorry Result Failed to add Try Again !!");
        </script>
        <?php
    }
    }else{
      ?>
         <script type="text/javascript">
             alert("Sorry Result Already added");
         </script>
    <?php 
  } 
  
}