ajout-client.php 623 B

12345678910111213141516171819
  1. <?php
  2. // var_dump($_POST);
  3. if ($_SERVER['REQUEST_METHOD'] === 'POST') {
  4. $hostname = "localhost";
  5. $username = "root";
  6. $password = "Bdtbdt17?";
  7. $port = "3306";
  8. $db = "intra";
  9. $dbconnect=mysqli_connect($hostname,$username,$password,$db,$port);
  10. $q = 'INSERT INTO client (name, type, localisation, departement) VALUES ("%s","%s","%s","%s")';
  11. $query = mysqli_query($dbconnect, sprintf($q,$_POST["name"],$_POST["type"],$_POST["localisation"],$_POST["departement"]))
  12. or die (mysqli_error($dbconnect));
  13. $dbconnect->close();
  14. header('Location: index.php');
  15. }
  16. ?>