DEV Community

Cover image for Redirecting url trick
Heggy Castaneda
Heggy Castaneda

Posted on

Redirecting url trick

Submit Email to Get Thank You Gift

I want to talk about how to redirect user to a Thank you page only after the user submits one's email.

Use form action="./new-page.html". Once form is submitted; user is redirected to your-current-page/thank.html.

Remember to add input required attribute to email field! This forces user enter email before user gets redirected to the thank-you page.


  <h1>Welcome sign up</h1>
  <form action="./thank-you.html">
    <label for="email">Email:</label>
    <input type="email" id="email" required>
    <input type="submit" value="Submit">
  </form>

In Thank-You page, link tag takes user to the gift!


<a 
class="button" 
href="https://docs.google.com/spreadsheets/d/1k4Wbbmds0bPOaf6SQutNfiOmb8lYlUWPnj3ggbbO6ac/edit#gid=2062450288" 
target="_blank">
Download Your Gift!!
</a>

Top comments (0)