How to save webpage data -- PHP development PHP website development database
The younger brother is developing a website using PHP;
There are three pages, each of which allows users to enter some content;
If you need to set up a database to save user settings on 3rd pages, how can you retrieve data on 1 or 2 pages on 3rd pages;
When the database has not been created in step 3 of step 3,
The user returns to the previous 1.2 page for further modification. in this case, the user needs to display some data that the user has just filled in. the user cannot leave nothing blank after the user returns the result and needs to be re-filled;
What should I do if there are many users? (Assume that 10 thousand million users use the service at the same time)
At present, I thought it was strange to set up a database after the user set up on pages 1 and 2 and read and process the database on 3rd pages.
For the first time, please kindly advise.
Reply to discussion (solution)
This younger brother, I think the first three steps can be written into the COOKIE or the SESSION. And then save it to the database.
Can you give me a simple example? Thank you.
You can also make three fake pages. in fact, three p switches back and forth. after clicking the next page, the first p is hidden and the second display is hidden. in this case, the information entered earlier must be
The method on the first and third floors is good.
"Back to the front" does it mean to press the back button or re-enter the url?
"Return to the front" means to press the back button.
This should be said: if the user sets the content of the 1.2 page. On the 3 page, I thought there was a change to the 1 page, so I returned to the 1 page for modification,
The result I want is that the user can see the last setting when returning to page 1!
This function is enabled by the browser, which saves the history record.
I did not make it clear that each page will give the user a default value for initialization. For example, if you use php to remove the current time, and the page data is definitely different for each user,
In this case, the browser will not save it, will it?
If there is a rollback, it is best to use a cookie, and there is no such thing as initialization. First, read the initialization, and then read the cookie. if the latter has a value, it will overwrite the former.
Cookie filling is the best choice
Or you can use the local stroage
For details, see
JavaScript local storage practices (html5 localStorage and ie userData)
First of all, you must be clear that a single user and 10 thousand users use the same processing method at the same time.
Therefore, you only need to consider how a user can do this.
Three pages, from the first to the second, from the second to the third. Actually, all operations are submitted.
If you allow users to roll back to the previous page, you should set a rollback button on the page, instead of relying only on the browser's back button.
The browser's back button will reply to the scene of the previous form, but it is not always the action you need
When session is used on a single table page, the browser will be prevented from restoring the site by default.
You can also make three fake pages. in fact, three p switches back and forth. after clicking the next page, the first p is hidden and the second display is hidden. in this case, the information entered earlier must be
Why don't one page be used for the solution? one page is submitted in three parts, and the content can be changed as needed.
The server is under heavy pressure when the session is used by tens of thousands of users at the same time.
The general solution is:
Enter input on the first page and post it to the second page.
Fill in input on the second page and add the value submitted on the first page, as shown in figure
On the third page, enter input and add the values submitted on the first two pages, as shown in figure
And how to handle it?
The third floor is supported. if initialization is required, it can be used in combination with Ajax ~~~
You can also make three fake pages. in fact, three p switches back and forth. after clicking the next page, the first p is hidden and the second display is hidden. in this case, the information entered earlier must be
Why don't one page be used for the solution? one page is submitted in three parts, and the content can be changed as needed.
You can also make three fake pages. in fact, three p switches back and forth. after clicking the next page, the first p is hidden and the second display is hidden. in this case, the information entered earlier must be
Why don't one page be used for the solution? one page is submitted in three parts, and the content can be changed as needed.
If it is rolled back, do you want to transfer it back?
The server is under heavy pressure when the session is used by tens of thousands of users at the same time.
The general solution is:
Enter input on the first page and post it to the second page.
Fill in input on the second page and add the value submitted on the first page, as shown in figure
On the third page, enter input and add the values submitted on the first two pages, as shown in figure
And how to handle it?
Do I have to upload the data back?
The server is under heavy pressure when the session is used by tens of thousands of users at the same time.
The general solution is:
Enter input on the first page and post it to the second page.
Fill in input on the second page and add the value submitted on the first page, as shown in figure
On the third page, enter input and add the values submitted on the first two pages, as shown in figure
And how to handle it?
Do I have to upload the data back?
It seems that this method is better. you don't need to consider cookies. if you roll back, you can make a form to be rolled back and submit it back to the page to be modified. which page does the last page add the database function you want to do?
You can also make three fake pages. in fact, three p switches back and forth. after clicking the next page, the first p is hidden and the second display is hidden. in this case, the information entered earlier must be
Why don't one page be used for the solution? one page is submitted in three parts, and the content can be changed as needed.
You can also make three fake pages. in fact, three p switches back and forth. after clicking the next page, the first p is hidden and the second display is hidden. in this case, the information entered earlier must be
Why don't one page be used for the solution? one page is submitted in three parts, and the content can be changed as needed.
If it is rolled back, do you want to transfer it back?
The rollback action is to hide the second part. The second part is to hide the second part. as long as you use different field IDs, these values are stored on the page all the time,