Entradas populares de este blog
Php-agregar
<?php $id = isset ( $_POST [ "id" ]) ? $_POST [ "id" ] : "" ; $nombre = isset ( $_POST [ "nombre" ]) ? $_POST [ "nombre" ] : "" ; $apellidos = isset ( $_POST [ "apellidos" ]) ? $_POST [ "apellidos" ] : "" ; $accion = isset ( $_POST [ "accion" ]) ? $_POST [ "accion" ] : "" ; if ( $accion ) { echo $accion ; switch ( $accion ) { case "agregar" : if (! empty ( $nombre ) && ! empty ( $apellidos )) { $conexion = conectar (); $sql = " INSERT INTO alumnos (id, nombre, apellidos) VALUES ( null , :nombre, :apellidos) " ; $consulta = $conexion -> prepare ( $sql ); $consulta -> bindParam ( ":nombre" , $nombre ); ...
limpiar la URL
Paso 1: Modificar el JavaScript para limpiar la URL Agrega un bloque de código para limpiar la URL después de mostrar la alerta de SweetAlert. <script> document.addEventListener('DOMContentLoaded', function() { // Función para mostrar alerta de SweetAlert function showAlert(success) { if (success === 'true') { Swal.fire({ title: 'Éxito', text: 'El registro fue guardado correctamente.', icon: 'success', timer: 3000, showConfirmButton: false }).then(() => { window.history.replaceState(null, null, window.location.pathname); }); } else if (success === 'false') { Swal.fire({ title: 'Error', text: 'Hubo un problema al guardar el registro.', icon: 'error', timer: 3000, ...
Comentarios
Publicar un comentario