Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

100
Vistas
Checking if url parameter exists and adding it to registration fields

I have a registration flow which is working great, name, dob, email, etc. submit, done. I also have a function where the user might come from somewhere else that knows there email address and it might be passed in the url. I would like my reg flow to check the url for the parameter and enter the email in the reg form.

So my basic input code looks like this...

<input type="email" id="your_email" placeholder="enter e-mail adresse">

If I append the url to include &email=123@abc.com, I can successfully pass the email in the url, grab it from the url and enter it into the input box like this...

<?php
$email = $_GET['email'];
?>
<input type="email" id="your_email" placeholder="enter e-mail adresse" value="<?php echo $email;?>

This is great and works. But, if someone arrives at the page and we haven't passed the email, then the email field is populated with the url token.

I'm wondering if anyone has a good idea to get around this please? I thought about saying...

the url contains empty parameter use the normal code with an empty box use the new code with prefilled email

...but I'm not sure how to code HTML inside a script.

I found this code...

<!DOCTYPE html>
<html>
<head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
 </head>
<body>
    <input id="para1" type="email" value="Check URL" />
</body>
<script>
    $(document).ready(function () {
        $("#para1").on("click", function () {
            if (window.location.href.indexOf('?book=') > 0) {
                console.log("The URL contains ?book");
            }
        });
    });
</script>
</html>

...but I would need to change the consol.log section to have the input code.

Any help would be great, thanks.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda