Ver Mensaje Individual
  #1 (permalink)  
Antiguo 14/06/2015, 09:29
Avatar de binshmikertan
binshmikertan
 
Fecha de Ingreso: noviembre-2014
Mensajes: 23
Antigüedad: 9 años, 5 meses
Puntos: 0
Pregunta error mensaje modal javascript y archivo php update

Buen dia comunidad de Foros del web tengo el siguiente problema tengo un archivo php donde tengo este trozo de codigo en javascript usando mensajes modales con alertify.js

Código PHP:
<script type="text/javascript">
      function 
performDelete a_element ) {
    
// perform your delete here
    // a_element is the <a> tag that was clicked

        
}


        function 
confirmAction a_elementmessageaction ) {
    
alertify.confirm(message, function(e) {
        if (
e) {
            
// a_element is the <a> tag that was clicked
            
if (action) {
                
action(a_element);
            }
        }
    });
}
  
</script> 
mas abajo una tabla con una opcion que me manda a una pagina php externa como se visualiza en este trozo de codigo

Código PHP:
<table class="table table-bordered" width="300" cellspacing="0">
    
    <tr>
<th width="100">Libro</th>
<th width="50">Numero De Libro</th>
<th width="50">Estado</th>
<th width="50">Año</th>
<th width="50">Cerrar Libro</th>

</tr>

<tr>

<?php
    
    $query
=pg_query("Select b.nombre,a.numerolibro,a.estado,a.anio,a.id FROM detallelibro a INNER JOIN libro b on a.id_libro=b.id AND a.estado='ABIERTO'  ORDER BY anio DESC LIMIT 20");
    
$row=pg_num_rows($query);
    
    if (
$row 0) {
        while (
$fill=pg_fetch_array($query)) {
            
$id$fill[4];
            
?>

            <td><?php echo $fill[0]; ?></td>
            <td><?php echo $fill[1]; ?></td>
            <td><?php echo $fill[2]; ?></td>
            <td><?php echo $fill[3]; ?></td>

<!-- boton que abre el mensaje modal confirm y me direcciona ala pagina php externa  -->
            <td align="center"><a href="updatelibro.php?id=<?php echo $id?>" onclick="confirmAction(this, 'Seguro que quiere cerrar el libro?', performDelete); return false;"><img src="../../../images/cerrar.png" width="25" height="25"></a></td>

<!-- boton que abre el mensaje modal confirm y me direcciona ala pagina php externa  -->

            <?php
        
}
        
    }
    else{
        
?><td colspan="4" align="center">No se puede mostrar nada porque no hay registros</td><?php
    
}

  
?>

    

</tr>


</table>
y este es el procedimiento de la pagina php externa
Código PHP:
<?php

include("../../../conexion/conexion.php");

$id=$_GET["id"];

$update=pg_query("UPDATE detallelibro SET estado='CERRADO' WHERE id='$id'");

if (
$update 0) {
         
        
//retorno ala pagina donde se visualizaba la tabla
    
header("location:cerrarlibro.php");

}

?>
soy novato en javascript espero me puedan dar una solucion al problema gracias feliz dia