1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
<html>
<head>
<title>suppression de données en PHP </title>
<script type="text/avascript">
function confirme( identifiant )
{
var confirmation = confirm( "Voulez vous vraiment supprimer cet enregistrement ?" ) ;
if( confirmation )
{
location.href = identifiant;
//alert("Oui");
}
}
</script>
<a href="javascript.confirme('delet.php?id=<?php echo $id; ?>');"></a>
</head>
<body>
<?php
session_start();
include("connexion.php");
connect($host,$user,$mot_passe,$db_name);
$sql = "SELECT *
FROM pc
ORDER BY id" ;
$requete = mysql_query($sql);
while( $result = mysql_fetch_object($requete ) )
{
echo("<div align=\"center\">".$result->nom." ".$result->prenom." <a href=\"#\" onClick=\"confirme('".$result->id."')\" >supprimer</a><br>\n") ;
//echo '<input type="button" onclick="if(confirm(\'Voulez vous vraiment supprimer cet enregistrement\'){window.location.href=\'delet.php?id='.$result['id'].'&action=delet\'})" value="confirmer"/>';
}
?> |