Make registration popup made!

Asked

Viewed 26 times

0

Good morning,

I want to jump up popup when the registration is successfully performed and placed at the base and want to know what part of the code I should put it on

This is the php file:

 <?php
         
        if(isset($_POST)&&!empty($_POST)){  
           $nome=$_POST["nome"]; 
            $apelido=$_POST["apelido"];
            $email=$_POST["email"];
            $pass= hash('sha512',hash('sha512',hash('sha512',hash('sha512',hash('sha512',hash('sha512',($_POST["pass"]))))))) ;
                  //   $pass= hash('whirlpool',hash('sha512',hash('sha384',hash('sha256', sha1 (md5($_POST["pass"]))))));
            $telefone=$_POST["telefone"];
            $nif=$_POST["nif"];
            $empresa=$_POST["empresa"];
            $morada=$_POST["morada"];
            $codigopostal=$_POST["codigopostal"];
            $cidade=$_POST["cidade"];
            $pais=$_POST["pais"];   
        include ("db.php");     
    
            $criar="INSERT INTO utilizador (nome, apelido, email, pass, telefone, nif, empresa, morada, codigopostal, cidade, pais) VALUES ('$nome', '$apelido', '$email', '$pass', '$telefone', '$nif', '$empresa', '$morada', '$codigopostal', '$cidade', '$pais')";
         
        
        if ($con->query($criar)) { 
header('location: criar.php');   
            
} else { 
echo "Error: " . mysqli_error($con); 
}
            $con->close();
        }

   ?>

This is the other file where the form is:

        <br>
     <div class="container">
         <div class="card">
         <div class="card-header" style="background-color:f7f7f7;">
               <h2 style="color:#1751A3;">Registar</h2>
               </div>
         </div>
         <form method="post" action="criaraction.php" id="dados">  
               <br>
<div class="card-group"><!--deck-->
        
  <div class="card">
      <div class="card-header" style="background-color:#F8F9FA;" >
         <h5 class="card-title">Dados Pessoais</h5>
      </div>
    <div class="card-body">
<!--<form method="post" action="" id="dadospessois">-->
            <div class="row">
                <div class="col-sm-6">
            <label for="Nome">Nome:</label>
            <input type="text" class="form-control" name="nome" required/>
                    </div>        
                <div class="col-sm-6">
            <label for="Apelido">Apelido:</label>
            <input type="text" class="form-control" name="apelido" required/><br>
                </div>
            </div>
           <label for="email">Email:</label>
            <input type="email" class="form-control" name="email" required/><br>   
            <div class="row">
            <div class="col-sm-6">
            <label for="pass">Password:</label>
            <input type="password" class="form-control" name="pass" required/> 
            </div>
                <div class="col-sm-6">
            <label for="pass2">Confirmar Password:</label>
            <input type="password" class="form-control" name="pass2" required/> 
            </div>
            </div> 
      <!--  </form>-->
    </div>
  </div>
  <div class="card">
      <div class="card-header" style="background-color:#F8F9FA;">
         <h5 class="card-title">Dados da Empresa</h5>
      </div>
    <div class="card-body">
       <!-- <form method="post" action="" id="dadosempresa">-->
            <label for="empresa">Empresa:</label>
            <input type="text" class="form-control" name="empresa" required/><br>
        <div class="row">
        <div class="col-sm-6">
            <label for="nif">NIF:</label>
            <input type="text" class="form-control" name="nif" required/><br>
            </div>
            <div class="col-sm-6">
           <label for="telefone">Telefone:</label>
            <input type="text" class="form-control" name="telefone" required/><br>
            </div>
            </div>
            <label for="morada">Morada:</label>
            <input type="text" class="form-control" name="morada" required/>       <br>  
        <div class="row">
            
            <div class="col-sm-6">
            <label for="codigopostal">Código postal:</label>
            <input type="text" class="form-control" name="codigopostal" required/><br>
                </div>
            <div class="col-sm-6">
            <label for="cidade">Cidade:</label>
            <input type="text" class="form-control" name="cidade" required/>
                </div>
        </div>
       <div class="col-sm-6">
            <label for="exampleFormControlSelect1">País:</label> 
            <select class="form-control" name="pais" name="pais"> 
    <option value="PT">Portugal</option>
    <option value="ES">Spain</option>
    <option value="FR">France</option>
    <option value="IT">Italy</option>
    <option value="DE">Germany</option>
    <option value="GB">United Kingdom</option>
	<option value="US">United States</option>
	<option value="BR">Brazil</option>
</select> 
        </div>
                   <!--</form>-->

    </div>
  
  </div>
</div>
<div class="card-footer text-right" style="background-color:#FFFFFF;">
<button type="submit" align="right" class="btn btn-primary" value="submit">Continuar</button> 
               </div>
                   
             </form>
  </div>      
 

I was wondering which one of the files I put the popup code in

1 answer

1


Changes the header():

if ($con->query($criar)) { 
    echo '<script type="text/javascript">if(confirm("Cadastro realizado com sucesso")){window.location.href="criar.php";}else{window.location.href="criar.php";}</script>';
} else { 
    echo "Error: " . mysqli_error($con); 
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.