Insertion des notes à partir d'un formulaire vers la base de donnée

Signaler
-
Salut ,
J'ai déjà crée un formulaire pour insérer les notes mais lorsque je tape le bouton valider le tableau se désappariait et rien s'ajoute sur la base de donnée.
<!DOCTYPE html><html><body>
<?php
include '../libs/DB_connection.php'; 
include '../libs/selector_filiere.php';
include '../libs/selector_matiere.php';
session_start();
if ( !isset( $_SESSION['user_id'] ) ) {
     header("Location:../index/index.php");}
#****************
$id=$_SESSION['user_id'];
$sql_name="select PRENOM_PROF from professeur where CIN_PROF ='$id'";
$result_name=mysqli_query($conn,$sql_name);
$row=mysqli_fetch_array($result_name);
 $_SESSION['name_prof']=$row['PRENOM_PROF'];
#****************?>
<?PHP include '../include/header_limit_prof.php'; ?>
<!--*******************************|||| -->
<!--THE functions-->
<?php
function ajouter($ds1,$ds2,$ds_tp,$conn,$mat,$cne){
$moyen=($ds1 + $ds2 + $ds_tp)/3; 
$sql="INSERT INTO note(ID_MATIERE, CNE, DS1, DS2, DS_TP, MOYEN) VALUES('$mat','$cne','$ds1','$ds2','$ds_tp','$moyen') ";
$result=mysqli_query($conn,$sql);
if (isset($result)) {
echo "<script> alert('Ajouter avec sucess ');</script>";
echo "<br>";
}}
function hello(){echo "hello world" ;}
?>
<!--end functions-->
<!--LE TRAITEMENT-->
 <h1 style="margin-bottom:30PX;">Gestion des Notes</h1>
 <div class="container">
<form method="post"  action="<?php echo $_SERVER['PHP_SELF'];?>">
 <div class="form-row">
          <!-----traitement de la filiere---->
          <div class="form-group col-md-4">
               <label for="inputFiliere">Filiere:</label>
    <select id="inputFiliere" class="form-control" name="fil_selected" required>
    <option value="">choisir..</option>
     <?PHP 
     while ($row2=mysqli_fetch_array($result_filiere)) {
          echo"<option value='" . $row2['ID_FILIERE'] . "'>" . $row2['NOM_FILIERE'] . "</option>";
     } ?>
    </select>
   </div>
  
  <!-----traitement du matiere---->    
  <div class="form-group col-md-4">
  <label for="mat_selected">Matiere</label>
     <select id="mat_selected" class="form-control" name="mat_selected" >
   <option value="">choisir..</option>
    <?PHP while ($row4=mysqli_fetch_array($result_matiere)) {
         echo"<option value='" . $row4['ID_MATIERE'] . "'>" . $row4['NOM_MATIERE'] . "</option>";
    } ?>
     </select>
     </div>
  </div><br><br>
  <input type="submit" name="submit" value="Selectioner" class="btn btn-danger">
  </form>
</div><br><hr>
<!-- ******************** |||  -->
<div class="container">
  <table class="table table-hover ">
    <caption>List of etudiant</caption>
    <thead class="thead-dark">
        <tr>
    <th>CNE</th>
          <th>Nom</th>
          <th>Prenom</th>
          <th>DS1</th>
          <th>DS2</th>
          <th>DS TP</th>          
          <th>Action</th>          
        </tr>
    </thead> 
<?php
if(isset($_POST['submit'])):
$fil=$_POST['fil_selected'];
$mat=$_POST['mat_selected'];
 $sqlEtudiant="select * FROM etudiant WHERE ID_FILIERE='$fil' and NOM_ETD !='admin'" ; 
 $resultEtudiant= mysqli_query($conn,$sqlEtudiant);
?>
 <tbody>
   <?php while($etudiant=mysqli_fetch_array($resultEtudiant)) :?>
        <tr>
            <td><?= $etudiant['CNE'] ?></td>
            <td><?= $etudiant['NOM_ETD'] ?></td>
            <td><?= $etudiant['PRENOM_ETD'] ?></td>   
   <form method="post"  action="<?php echo $_SERVER['PHP_SELF'];?>">       
    <td ><input name="ds1" type="number" style="width: 50PX">  </td>          
    <td><input name="ds2" type="number" style="width: 50PX">  </td>          
    <td><input name="ds_tp" type="number" style="width: 50PX">  </td>  
   <input type="hidden" value="<?php echo $etudiant['CNE']; ?>" name="cne"?>>      
    <td><input name="commit" type="submit"> </td>   
   </form>
   <?php
   if(isset($_POST['commit'])){
    $ds1=$_POST['ds1'];
    $ds2=$_POST['ds2'];
    $ds_tp=$_POST['ds_tp'];
    $cne=$_POST['cne'];
    echo $ds1 . " " . $ds2 . " " . $ds_tp . " " . $conn . " " . $mat . " " . $cne;
    hello();
    #ajouter($ds1,$ds2,$ds_tp,$conn,$mat,$cne);
   }
   ?>
        </tr>
    <?php endwhile;?>
</tbody>
  <?php endif;?>
 </table>
</div>
<!--la fin de traitement-->
<?PHP include '../include/footer.php';?>
</body></html>