How do I make a registration system where the user at first inform only the email?

Asked

Viewed 50 times

0

I would like to know how to create a registration system where the user at first inform only the email, soon after it will be directed to another page, where will complete the registration with the email already filled.

  • Well, you should first choose a programming language which you want to tarablhar as php c#(Asp.net) java and so on, after that you will also need a database, to amaze the data, your question got very Generica could specify-the best language and which language it uses ?

  • What server language do you use? (e.g. PHP)

  • I use the PHP language, the problem is not to register the user, first it would be displayed to the user only an input type mail, soon after filling the email he will be directed to another page to finish his registration. my doubt is cmo save the email informed is to continue to fill the data on another page, where the email field should already be filled. HERE IS AN EXAMPLE https://www.baratosuplementos.com.br/checkout/

  • I believe that in this example of site you gave @Diegolima is to verify the existence of some record in the same email

  • I think storing the email in $_SESSION is a good one

1 answer

0

As a registration issue involves many validations etc., I will only address the basic steps you can use.

It would basically work as follows using 3 pages:

  • cadastro1.php

The first page where the user informs only the email to go to the page cadastro2.php. On this page there would be a form such as:

<form method="post" action="cadastro2.php">
   <input required type="email" name="email" placeholder="Informe seu e-mail">
   <br>
   <button>Prosseguir</button>
</form>
  • cadastro2.php

In this second page you will receive the email informed on the first page via POST. On this page and on the third, you should check if the information was sent from the previous page; if not, you redirect to the first page because the user can try to access the page without going through the previous one:

<?php
$email = $_POST['email']; // pego o campo "email" enviado pela primeira página

if(empty($email)){ // verifico se está vazio
   header('Location: cadastro1.php'); // se estiver vazio, redireciona para a 1ª página
}
?>

<form method="post" action="cadastro3.php">
   <strong>E-mail:</strong> <?php echo $email?>
   <input type="hidden" name="email" value="<?php echo $email?>">
   ...
   resto dos campos do formulário
</form>

In this second page you already have the user’s email stored in the variable $email. In the example above you can create a input hidden and fill with the email to be sent along with the form.

  • cadastro3.php

On this last page, you will receive all the fields sent by the page form cadastro2.php and finish by sending the information to the database.


This is just a very basic scheme of how you could do it. Of course there are more efficient and lean ways for more advanced users. But since your question just wants to know how to send an email from one page to another, I think it might help you get a sense of how it works.

  • 1

    Thank you very much, that’s what I was looking for, helped me get a sense of what to do!

  • Diego, finish the question by marking in the answer. If there are any questions about how to do this, please let us know.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.