php - Requiring user to fill up 1st form before being able to access 2nd form? (change password)

I have these fields for my registration page:
- Username
- Password
- Secret Question
- Secret Answer
So normally, changing password is simply like:
User visits change password page > then show field for Current Password & new password fields > enter correct current password & fill in new password > success password changed
Im wondering, how to make it like this:
User Visits change password page > then show 1st form (secret question & secret answer) > if secret question & answer fields are given correct > Give access & redirect to/or show second form (with current password & new password fields)
What is the way to do it so users are required to enter correct answers to the first form to get some sort of unique authentication before they're able to change their password? So they can't just bypass/access the change password form?
Answer
Solution:
SOLVED! Thanks @Stefino76 (from my previous post)
I used $_SESSION variable to store & compare data from database.
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: foreign key constraint is incorrectly formed laravel
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.