redirect in php

-2

I am making a registration form and when checking the data I ask if the mail or the user is not registered, everything works fine, the problem is that once the error is displayed, I am ok and redirected to registration. php and I want you to stay in index.php

I leave the code where the problem should be

    if ((mysqli_num_rows($existente)>0) or ($clave != $claverep)){
   echo "<script>alert(\"Error en el registro\")</script>";
  "<script> window.location.replace=../index.php'</script>";
    }
    
asked by Houth 20.11.2017 в 20:06
source

2 answers

0

You are missing a quote on the line where you do the replace to the location:

if ((mysqli_num_rows($existente)>0) or ($clave != $claverep)){
  echo "<script>alert(\"Error en el registro\")</script>";
 echo "<script> window.location.replace('../index.php'); </script>";
   }
    
answered by 20.11.2017 в 20:08
0

I already solved it missing an echo in the second script and had one. of more in the ./index.php

if ((mysqli_num_rows($existente)>0) or ($clave != $claverep)){
   echo "<script>alert(\"Error en el registro\")</script>";
  echo"<script> window.location=('./index.php')</script>";
    }
    
answered by 20.11.2017 в 20:25