Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

91
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda