Feature rich web pages utilize Hypertext Preprocessor technology (PHP), which is a dynamic programming language used for passing values in the URL in PHP web pages. The URL of a website contains valuable information, such as the category, article title, and creation date. This technique is valuable when one must tell a content management system (CMS) what data to load.
The GET Command
The PHP GET command enables information to be passed from one page to another within a website. The GET method is transparent and occurs behind the scenes. The technology is used when executing search queries in websites such as Google or Bing. In order to use the GET command, format the data according to PHP specifications.
Understanding the Terminology
- The GET command is used to pass variables and values discretely through the URL.
- The POST command is used by web forms to post the information to a database.
- Syntax is the programming language that is used to develop PHP web pages.
- A value is a piece of information that is assigned to a variable.
- Variables are used to store values without having to type out the value itself.
In order to learn PHP you should have an understanding of basic HTML tags.
Passing Values in the URL in PHP
When passing values in the URL in PHP, format the content to the PHP specification.
PHP GET Example:
A question mark is placed at the end of the page name, which engages the PHP engine by calling the variables var1 and var2. An equal sign is placed at the end of each variable, which identifies the information that is mapped to it. An ampersand (&) symbol separates the two data sets. For example, when the page calls "var1" the system will display "val1" on the screen.
Example 1: Searching in Google
When a user goes to and enters a search query, the information is passed in the URL. The results page appears with the URL of .
|hl||en||The Search Language (hl) is English (en)|
|q||my query||The Search Term (q) is my query|
Working with Values and Variables
Use variables in PHP to identify memory locations to store data. You can create an unlimited number of variables in PHP. For an element to be recognized as a variable it must begin with a dollar sign. When working with PHP code it is important to end each line with a semicolon (;) because the system does not recognize line breaks. Additionally, variables are automatically identified as strings or numbers, unless expressed otherwise. Variables can contain characters letters (a-z, A-Z), numbers (0-9), and underscores (_). Special characters such as "*", "+", "#", "@" are not allowed. For more information on working with variables, consider exploring more PHP tutorials.
Utilize the PHP GET command to accomplish a variety of tasks, such as sending e-mail messages, adding comments, changing directories on a server, or posting a new forum topic. Sending messages via the GET command is not secure, so not ideal for confidential material.
Entering "http://email@example.com&subject=Testing123&body=Test" into your web browser would use the following code:
Someone at the address firstname.lastname@example.org would receive an email with the subject of "Testing123" and body containing the word "Test."
The PHP programming language is complicated, however; the PHP User Manual provides in depth information on all of the functions PHP has to offer.