Ver Mensaje Individual
  #14 (permalink)  
Antiguo 27/03/2007, 07:37
Avatar de ZiTAL
ZiTAL
 
Fecha de Ingreso: marzo-2004
Ubicación: Bermio (Bizkaia)
Mensajes: 1.545
Antigüedad: 20 años, 2 meses
Puntos: 62
Re: Preguntar antes de borrar

index.php

Código PHP:
<?php
// includes, conexiones base de datos etc...
$select="select id,nombre from tabla";
$select=mysql_query($select);
?>
<html>
<head>
<script type="text/javascript">
function go(msg,url)
 {
    if(msg=="")
     {
        location.href=url;
     }      
    else
     {
        if(confirm(msg))
         {
            location.href=url;
         }
     }
 }
</script>
</head>
<body>
<?php
while($row mysql_fetch_array($select))
 {
  
?>Nombre: <?php echo $row["nombre"]; ?> <img src="borrar.png" alt="Borrar" onclick="go('¿Estas seguro de que desea borrar: <?php echo $row["nombre"]; ?> ?','borrar.php?id=<?php echo $row["id"]; ?>')" /><br /> <?php 
 
}
?>
</body>
</html>
borrar.php

Código PHP:
<?php
// includes, conexiones base de datos etc...
$id=$_GET["id"];
$delete="delete from tabla where id=".$id." limit 1";
$delete=mysql_query($delete);
header("Location: index.php");
exit();
?>
es un ejemplo donde esta bastante claro, suerte!!!!
__________________
http://zital.no-ip.org
____________________

Euskerie ahuen eta bijotzan