<?php
session_start();
$companyname=$_SESSION['companyname'];//;
$adminemailid=$_SESSION['emailid'];//;
include '../Model/configuration.php';
date_default_timezone_set("Asia/Kolkata");
$DateandTime=date("Y-m-d H:i:s");
        
if(isset($_POST['idno'])){
    $id= $_POST['idno'];
    $percentage= $_POST['percentage'];
    $name= $_POST['name'];
     include '../Model/configuration.php';
     $sql="UPDATE `sales_pipeline_type` SET `pipe_name`='$name',`pipe_percentage`='$percentage', pipe_datetime='$DateandTime' WHERE `id`='$id' ";
     $em=$pdo->prepare($sql);
        $em->execute();
        
}
?>
<?php
if(isset($_POST['percentage_insert'])){
    $percentage1=$_POST['percentage_insert'];
    $name1=$_POST['name_insert'];
    for($i=0;$i<count($percentage1);$i++){
        $percentage=$percentage1[$i]."%";
        $name=$name1[$i];
        echo $sql="INSERT INTO `sales_pipeline_type`( `companyname`, `adminemailid`, `pipe_name`, `pipe_percentage`, `pipe_created_by`, `pipe_created_type`,`pipe_datetime`) VALUES ('$companyname','$adminemailid','$name','$percentage','$adminemailid','admin','$DateandTime')";
        $em=$pdo->prepare($sql);
        $em->execute();
    }
}
        
if(isset($_POST['deleteno'])){
    $id= $_POST['deleteno'];
     include '../Model/configuration.php';
     echo $sql="UPDATE `sales_pipeline_type` SET `pipe_deleted`='yes', pipe_datetime='$DateandTime' WHERE `id`='$id' ";
     $em=$pdo->prepare($sql);
        $em->execute();
        
}
?>