Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Appel de la BDD
- include_once ("bdd.php");
- // L'utilisateur a cliqué sur le bouton submit ?
- if (isset($_POST) && count($_POST) > 0) {
- // 1 - On récupère toutes les infos du formulaire
- extract(array_map("htmlspecialchars", $_POST));
- // 2 : Connexion
- $bdd = getDataBase();
- $resultat = $bdd->query('SELECT MAX(numeroClient) AS max FROM clients ORDER BY numeroClient ASC');
- $donnees = $resultat->fetch();
- $newId = intval($donnees["max"]) +1;
- var_dump($civil);
- $nbInsert = 0;
- try
- {
- // Mise à jour dans la bd
- $query = "INSERT INTO clients(numeroClient, civil) VALUES(:pId, :pcivil)";
- $stmt = $bdd->prepare ($query);
- $stmt->bindParam(':pId', $newId);
- $stmt->bindParam(':pcivil', $civil);
- $nbInsert = $stmt->execute();
- echo "yo";
- }
- catch(Exception $e)
- {
- $nbInsert = 0;
- }
- header("Location: liste.php?req=".$nbInsert);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement