Bonsoir à tous, je voulais créer un bouton de suppression, voici comment j'ai procédé:voici mon fichier php:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 <td> <input type="button" onclick="supprime(<?php echo $set['immatriculation'];?>)" name="delete" value="delete"></td> <script language="JavaScript"> function supprime(sup){ if(confirm("veux tu supprimer?")){ window.location.href='SupprimerVehicule.php?immatriculation='+sup+''; return true;} } </script>
Code php : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 <?php /** * Created by PhpStorm. * User: satellite * Date: 08/04/2017 * Time: 08:06 */ //echo "<pre>"; print_r($_GET); echo "</pre>"; require_once 'connexion.php'; $code= $_GET['immatriculation']; $req=$conn->prepare("delete from vehicule where immatriculation =:A"); $req->execute(Array(':A'=>$code)); header("Location:http://localhost/Sites/fiches/fichevehicule.php"); ?>
Le problème est que quand je click sur le bouton de suppression rien ne se passe.
Partager