• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Lesson 3. Variables and Functions > Passing a Variable Between Two Templates

Passing a Variable Between Two Templates

Because the Web is stateless (that is, a connection is not maintained between the Web server and the browser), it is sometimes necessary to pass a variable to another page in order to be able to keep using it. If you needed to pass an ID for a product from one window to the next, you could store it as a shared memory variable such as a session variable, but it's much easier to pass this variable to the template instead.

The easiest way to do this is through the URL of the template to which we want to pass the variable. When a variable is passed through the URL, it is appended to the end of the URL. If you have spent any time surfing the Web you have undoubtedly seen a URL variable. Many times they look like a mess of gobbledygook at the end of a recognizable URL. But that's not always the case; many times, simple values are passed through the URL. For example, the following URL passes several values to the next template:


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint