Of course, this is not the end. After all, if we can create multiple forms on a page, why cannot we create a form that spans multiple pages? Unfortunately, it is not easy to transfer data from one page to another through HTTP. Because HTTP does not
Of course, this is not the end. After all, if we can create multiple forms on a page, why cannot we create a form that spans multiple pages?
Unfortunately, it is not easy to transfer data from one page to another through HTTP. Because there is no built-in mechanism in the HTTP protocol to define the concept of a series of pages. However, with some flexible techniques and some useful PHP functions, we don't have to spend too much effort to break through this restriction. In this chapter, the key idea is to import the obtained on the previous page to the hidden variable in the form on the next page. When we switch between different pages on the screen, the code also transmits information between pages, each form contains the data of the previous form. This method seems a bit clumsy, but it is currently the easiest method-and does not need to use databases or cookies.
It is expected that we will expand the application of the variable $ state to adapt to this feature. This is why we have learned about this technique and have no intention of applying a simpler method to process multiple forms on a single page.
For convenience, we will repeat the previous form model. But this time we split it into two pages, rather than placing the important titles of the cheese on the same page as the user name.
In this way, we can get three functions instead of two. In addition, the function is slightly renamed to reflect the changes in its content. Display_form () is now renamed display_name ().
Function display_name (){
Global $ PHP_SELF;
?>
}
?>
Similar to the functions described above, we solve the next title and change the name of the next stage to cheese to better understand what to do next.
The following is display_cheese ().
Function display_cheese (){
Global $ PHP_SELF;
Global $ name;
?>
Favorite Cheese:Very soft French Brie
Farmhouse English Cheddar
Italian Buffalo Mozzarella
Favorite Times to Eat Cheese:Morning
Noon
Dinner