|
|
Different methods for passing values from one page to another page
June 21, 2008 – 12:44 pmWe often have to pass values of variables between pages in our web site. These are required in many different types. Some time we gather few values from database and want to retain the value throughout the site for some user as the user moves between pages. There are different methods for passing such values of the variables. It can be passed within a site pages or even outside the site. following are few examples.
Passing values using session between pages
This is one of the secured ways to pass the values between pages. The best example of such a system is when we see our user details inside the member section after we logged in. In the member login system a new session gets created if the given details are correct. These value is stored at server end. Whenever a new page is requested by the same user, the server checks the for existing session value and gives the access to that page. This system is more secure and the member doesn’t get any chance to change the values.
Passing values using cookies between pages
Cookies are stored at the user/ client side and values can be passed between pages. Here the client browser can have the option of reject or accept the cookies by changing the security settings of the browser. Sometime this system can fail to pass values between pages if user or client end settings are changed.
Passing values using URL between pages
We can pass values between pages using the URL. These values are visible to the user and others as they appear in the URL. This is not a secure way to transfer important data like password, etc.
Passing values using web forms
Forms are used mainly to collect data and transfer these data to a processing page. Here the processing page uses one of the above methods to pass values to different pages as per the requirements. Forms can be used to pass values to different sites. we can access the data using $_GET or $_POST methods depending the form method

