Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

90
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!