Hello Guys!
I'm sorry for being a bit late, it's just because of exams that's why I cannot connect to keep learning more from you as I can see in your comment too much infos to save. I can't tell you how much I'm happy for all of this content you have posted, Thank you for your help I've noticed a lot of things here which means I must keep learning and try my best to understand more about php.
I've tried all of your codes and nothing has work for me which absolutely means the problem is from me that's why I need your help in terms of explaining what mistakes I did till now. I will post full content to explain you more about my issue.
I've analyzed all your codes and mine too. and I guess it can be made without the use of database actualy, if the user is logged in so I will just take his password which is a text code named "pasword" and insert it inside the input's value => BUT IT DIDN'T WORK WITH ME (-_-)
as you can see guys below I want to send a user after he logged in to another page which is called "formulaire" and recuperate the values there. You can notice there is no extension after the name's file because I'm working with .htaccess file and a redirection function so everyting works fine for me.
login.php
<?php
if (isset($_POST['submit'])) {
$data = new CentersController();
$data->authCenter(); //this method is to let the user login after pressing the submit btn. and it works fine.
}
//This include shows alerts in case the user type a wrong username or password.
include('./views/includes/alerts.php');
?>
<section class="login-dark">
<form method="post" action="formulaire">
<div class="illustration"><i class="icon ion-ios-locked-outline"></i></div>
<div class="mb-3">
<input class="form-control" type="text" name="user" placeholder="User">
</div>
<div class="mb-3">
<?php //This a code as a text. I've just named it as "password" so it's not a password type in case you tought I'm wrong in input's type. ?>
<input class="form-control" type="text" name="password" placeholder="Action code">
</div>
<div class="mb-3">
<button class="btn btn-primary d-block w-100" type="submit" name="submit">LOGIN</button>
</div>
</form>
</section>
And here is the other file:
formulaire.php
<?php //You can notice here there is no php code, because after testing all of your codes so I just removed everything to give you a clean view. ?>
<div class="container" style="margin-top: 12px;">
<div style="background: #f8f8f8;padding: 36px;border-radius: 38px;">
<div class="row justify-content-center align-items-center">
<div class="col-8">
<form method="post" action="sendingData">
<h2 class="text-center" style="padding: 24px;"><strong>Formulaire d'insértion.</strong></h2>
<div class="mb-3">
<select class="form-select" required name="civilite">
<optgroup label="Civilité">
<option value="1" selected="">Monsieur</option>
<option value="2">Madame</option>
<option value="3">Mademoiselle</option>
</optgroup>
</select>
</div>
<div class="row">
<div class="col">
<div class="mb-3">
<input class="form-control" type="text" name="nom" placeholder="Nom" required=""></div>
</div>
<div class="col">
<div class="mb-3">
<input class="form-control" type="text" name="prenom" placeholder="Prénom" required=""></div>
</div>
</div>
<div class="mb-3">
<input class="form-control" type="text" name="telephone" placeholder="Téléphone" required=""></div>
<div class="mb-3">
<input class="form-control" type="email" name="email" placeholder="Email" required></div>
<div class="mb-3">
<input class="form-control" type="text" name="codepostal" placeholder="Code postal" required></div>
<div class="mb-3">
<select class="form-select" required name="imposition">
<optgroup label="Imposition">
<option value="1" selected="">Non imposable</option>
<option value="2">Moins de 2000€</option>
<option value="3">Moins de 2500€</option>
<option value="4">Entre 2500€ et 3000€</option>
<option value="5">Entre 3000€ et 5000€</option>
<option value="6">Entre 5000€ et 10000 €</option>
<option value="7">Plus de 10000€</option>
</optgroup>
</select>
</div>
<div class="mb-3">
<?php //So here is the problem as I told you before, I can't show the text typed in login password field => inside this field's value ?>
<input class="form-control" type="text" name="oid" value="" >
</div>
<div class="d-lg-flex justify-content-lg-center align-items-lg-center mb-3">
<button class="btn btn-success d-block w-100" type="submit" style="margin-right: 10px;margin-left: 10px;">ADD</button>
<a href="<?php echo BASE_URL; ?>clogout" class="btn btn-light d-block w-100" style="margin-right: 10px;margin-left: 10px;">LOGOUT</a>
</div>
</form>
</div>
<div class="col-4">
<div style="background: url("assets/img/nature.jpg") center / cover no-repeat;height: 476px;border-radius: 30px;"></div>
</div>
</div>
</div>
</div>
Thank you guys for your time, I appreciate all of your answers and your corrections.