<?php
session_start();
    header('Access-Control-Allow-Origin:*');
    header('Content-Type; application/json; charset=utf-8');
    header('Access-control-Allow-Method: POST');
    header('Access-control-Allow-Headers: Content-Type, Access-Control-Allow-Headers, Authorization, X-request-With');
    include('db.php');
        $inputdata = json_decode(file_get_contents("php://input"), true);
        
        $adresse_envoie = $inputdata['adresse_envoie'];
        $user = $inputdata['user'];
        $formation = $inputdata['formation'];



            $pubv=$db->prepare('INSERT INTO depot_perfect(adresse_envoie, user, formation) VALUES(?,?,?)');

            $pubv->execute(array($adresse_envoie,$user,$formation));
            
            if($pubv){
                include('mailAdmin.php');
                 echo(json_encode(['response' => 1]));
            } else{
                 echo(json_encode(['response' => 0]));
            }

        
        