Thursday 23 August 2012

Sending Variables from One Page to Another Page in PHP

Another major module in programming languages is sending variables from one page to another page. Usually, for many reasons we need to send some data on one page to be shown on another page. There are two major ways to send variables from one page to another page.

  • Sending variables by using forms.
  • Sending variables without forms.


Using HTML forms is used only if there is some form processing  required, but mostly we need variables to show data classification to users. Suppose, we need to see the products in a particular category, then in product page, we need the name of the category or some thing to classify the data.

And we can send variables embede within the anchor tags

Variables are embeded in URL

We can then retrieve these variable values on target page by using $_GET or $_REQUEST constructors in PHP. However, for security reason, always process data for sql injection or cross-site scripting vulnerabilities.

No comments:

Post a Comment