Learn to use php to create multi-page forms

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.