Hello.
How is it done so that within one PHP file, for example, anketa.php
, you can go to the next item in the same file (by pressing the "Next" button to bring up the next item, for example).
Let there be such a situation.
- The user goes to the profile page (
anketa.php
). - There is one input field and below button NEXT.
- He enters the name "Dude" and presses the NEXT button.
- A new input field appears, it says: "What do you smoke, brother?"
- He writes the word Banzai and presses MORE.
2 words appear:
Name: Dude
Smokes: Banzai
From now on you are recorded in the database
I want to learn how to do this within the same file.
I can horrible method. In the anketa.php
file anketa.php
first field, press NEXT (the variable goes into the session) transfers it to the anketa2.php
file, there it enters what it smokes, presses NEXT (this also into the session, total in 2 variables) and in the anketa_result.php file what he wrote, and immediately written to the database.
But how is all this in one file, I do not know (like anketa.php?question=2
).
Please, tell me a simple code so that I understand it further, or a link to an article may be.