2021年3月3日星期三

When I press submit it keeps loading but nothing happens

I have created a form for a simple user sing up wich I need to connect to my phpadmin database. When I press the submit buttom the page keeps on loading but doesnt show anything until it gives error because it surpased the waiting time period. So, it doesnt give me the message that it supposed to give and the data doesnt go to the database.

This is my form code on html:

<form action="../PHP/registrar.php" class="formulario" method="POST">                    <h1>Registrate</h1>          <div class="contenedor">                      <div class="input-contenedor">          <i class="fas fa-signature icon"></i>          <input type="text" name="nombre" placeholder="Nombre:" required>          </div>                        <div class="input-contenedor">          <i class="fas fa-user icon"></i>                   <input type="text" name="usuario" placeholder="Usuario" required>          </div>                    <div class="input-contenedor">          <i class="fas fa-key icon"></i>           <input type="password" name="contrasena" placeholder="Contraseña:" required>          </div>                    <div class="input-contenedor">          <i class="fas fa-phone icon"></i>          <input type="text" name="telefono" placeholder="Teléfono:" required>          </div>                             <input type="submit" value="Registrate" class="button">       <p>Al registrarte, aceptas nuestras Condiciones de uso y Política de privacidad.</p>       <p>¿Ya tienes una cuenta?<a class="link" href="..\pags\login.html"> Iniciar Sesión</a></p>  </div>                </form>        

And this is my PHP code:

<?php  $conectar= mysqli_connect("localhost","root","");  if(!$conectar){    echo"No se pudo conectar con el servidor";  }else{    $base= mysql_select_db('forms');  if(!$base){            echo"No se encontró la base de datos.";  }  }   $nombre=$_POST['nombre'];   $usuario=$_POST['usuario'];    $contrasena=$_POST['contrasena'];    $telefono=$_POST['telefono'];      $sql="INSERT INTO datos VALUES('$nombre',                             '$usuario',                             '$contrasena',                             '$telefono')";      $ejecutar= mysql_query($sql);      if(!$ejecutar){            echo"Hubo algún error";    }else{            echo"Datos Guardados Correctamente<br><a href='index.html'>Volver</a>";    }         ?>  

There's obviously a mistake in the code, I just can't seem to find it.

https://stackoverflow.com/questions/66468885/when-i-press-submit-it-keeps-loading-but-nothing-happens March 04, 2021 at 01:04PM

没有评论:

发表评论