How can i create multi page html form

I have a case where user inputs username and click continue, to reveal the password field, and then after password he clicks continue to reveal the otp code.

I don’t want to save the password in plain text, and hashing it is of no use because you can’t use hashed to compare against hash.

Is usually plaintext over hash, but since the plain text is not to be kept, how do i solve this?
Is there a way of creating multi page form that will hold its value before posting?

My weak method was
If submit username post it to database.
If submit password ________,
query the table to pull previous username.
Then show confirm otp.
But including this third part is a huge problem.

Because my only alternative is to equally post password to table so when third field is submitted i can query to retrieve both username and password from preentry table.

I try not to save the password in the preentry table even if it is automatically deleted after confirmation.

Please any better way of handling this?