I know that a tool called JOptionPane exists for Java that shows you a pop-up window, be it a message, a question, a confirmation, etc.
In Java, to show a message, use: JOptionPane.showMessageDialog ();
How could a pop-up window appear in PHP?
I want that once I have saved a record in the BD, or it is not saved, it shows me a message of the type:
Saved client | Client not saved
Code:
<!DOCTYPE html>
<html lang="es">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Formulario de Registro</title>
<link rel="stylesheet" href="css/estilos_registrar.css">
<script type="text/javascript" src="js/validar_formulario.js"></script>
</head>
<body background="imagenes/fondo_campo2.jpg">
<!--<h1>Formulario de Registro</h1>-->
<form name="miformulario" id="miformulario" action="registrar.php" method="POST" class="form-register" onsubmit="return validar_formulario();">
<h2 class="form-titulo">CREA UNA CUENTA</h2>
<div class="contenedor-inputs">
<!-- Por cada etiqueta de <input> <label for="id_mismo_que_input">XXXX: </label> --> <!-- required para HTML5 -->
<input type="text" name="nombre" id="nombre" placeholder="Nombre" tabindex="1" class="input-2" onkeypress="return soloLetras(event);">
<input type="text" name="apellidos" id="apellidos" placeholder="Apellidos" tabindex="2" class="input-2">
<br/>
<input type="text" name="idemail" id="email" placeholder="Email" tabindex="3" class="input-1">
<br/>
<input type="text" name="dni" id="dni" placeholder="DNI" maxlength="9" tabindex="4" class="input-2" onkeypress="return soloLetrasNumeros(event);">
<input type="text" name="telefono" id="telefono" placeholder="Teléfono" maxlength="9" tabindex="5" class="input-2" onkeypress="return soloNumeros(event);">
<br/>
<input type="password" name="password" id="password1" placeholder="Contraseña" tabindex="6" class="input-2">
<input type="password" name="password" id="password2" placeholder="Repetir contraseña" tabindex="7" class="input-2">
<br/>
<input type="submit" value="Registrar" name="registrar" class="registrar" tabindex="8"/>
<?php
include "Clases/BD.php";
//Si pulsamos el botón "Registrar"...
if(isset($_POST["registrar"])){
$nombre = $_POST["nombre"];
$apellidos = $_POST["apellidos"];
$dni = $_POST["dni"];
$telefono = $_POST["telefono"];
$idemail = $_POST["idemail"];
$password = $_POST["password"];
$idemails = BD::obtenerEmails();
if(in_array(strtolower($idemail), array_change_key_case($idemails,CASE_LOWER))){
header ("Location: no.php");
}else{
//Llamamos al método "insertarCliente" y le pasamos los parámetros del formulario.
BD::insertarCliente($idemail, $nombre, $apellidos, $dni, $telefono, $password);
header ("Location: si.php");
}
}
?>
<p class="form-link">¿Ya tienes una cuenta? <a href="iniciar_sesion_cliente.php">Ingresa aquí</a></p>
</div>
</form>
<!--<div class="footer">
<p>Copyrigth</p>
</div>-->
</body>
</html>