Mini Kabibi Habibi

Current Path : C:/Users/ITO/Desktop/From USB/fts/HEAD/
Upload File :
Current File : C:/Users/ITO/Desktop/From USB/fts/HEAD/add_voluntary_work.php

<?php
session_start();
$con = mysqli_connect("localhost","root","","personnel");

if(isset($_POST['save_multiple_data']))
{   
     $username = $_POST['username'];
    $org_name = $_POST['org_name'];
    $start_date = $_POST['start_date'];
    $end_date = $_POST['end_date'];
    $hr = $_POST['hr'];
    $nature = $_POST['nature'];
   
    foreach($username as $index => $usernames)
    {   
        $s_username = $usernames;
        $s_org_name = $org_name[$index];
        $s_start_date = $start_date[$index];
        $s_end_date = $end_date[$index];
         $s_hr = $hr[$index];
          $s_nature = $nature[$index];
         
        // $s_otherfiled = $empid[$index];

        $query = "INSERT INTO voluntary_work (username,org_name,start_date,end_date,hr,nature) VALUES ('$s_username','$s_org_name','$s_start_date','$s_end_date','$s_hr','$s_nature')";
        $query_run = mysqli_query($con, $query);
    }

    if($query_run)
    {
        $_SESSION['status'] = "Multiple Data Inserted Successfully";
        header("Location: trainings.php");
        exit(0);
    }
    else
    {
        $_SESSION['status'] = "Data Not Inserted";
        header("Location: voluntary_work.php");
        exit(0);
    }
}
?>