Registration in PHP
Now let's implement registration. For
this, we'll create a separate page register.php.
When visiting this page, the user should
see a form where they must enter
their desired login and password:
<form action="" method="POST">
<input name="login">
<input name="password" type="password">
<input type="submit">
</form>
Upon clicking the submit button, the user's login
and password should be added to the
database using an INSERT query,
like this:
<?php
if (!empty($_POST['login']) and !empty($_POST['password'])) {
$login = $_POST['login'];
$password = $_POST['password'];
$query = "INSERT INTO users SET login='$login', password='$password'";
mysqli_query($link, $query);
}
?>
Then the user can go to the authorization page, enter the login and password under which they registered, and log in.
Implement the registration described above. After that, register a new user and log in under their account. Make sure everything works as it should.
Modify your code so that in addition to the login and password, the user also needs to enter their date of birth and email. Save this data to the database.
Modify your code so that the registration date is automatically saved to the database.