Php external PHP variable introduction: This is a php external PHP variable details page, introduced and php, related knowledge, skills, experience, and some php source code.
Class = 'pingjiaf' frameborder = '0' src = 'http: // biancheng.dnbc?info/pingjia.php? Id = 326450 'Rolling = 'no'> HTML form (GET and POST)
When a form is submitted to a PHP script, the variables obtained from the form are automatically set to available by the PHP script. See the following example:
Example 5-2. Simple form variable (Simple form variable)
After submission, PHP creates a variable "$ name", which will contain any content entered in the form in "Name.
PHP also knows how to arrange the context of Form variables, but only once. You can, for example, describe a group of variables at the same time, or use this feature to retrieve values from multiple selection inputs:
Example 5-3. More complex form variables
If the track_var feature of PHP is enabled, any structure settings or Indicates, and then submitted through the variable in POST or GET mode, it will be found that it is appropriate to use the global union arrays "$ HTTP_POST_VARS" and "$ HTTP_GET_VARS.
Graphic submission variable name
When submitting a form, an image may be used to replace the standard tagged button, for example:
When the user clicks any position of the image, the corresponding form will be transmitted to the server using two additional variables (sub_x and sub_y. They contain the location information of users' clicks on the image. This will contain the real variable name (or even underline) from the browser, but PHP will automatically convert it into an underlined form.
HTTP Cookies
PHP certainly supports HTTP Cookies defined by Netscape's Spec. Cookies are a device for storing data in a remote browser. they are used to track and identify users. You can use the SetCookie () function to set cookies. Cookies are part of the HTTP header, so the SetCookie program must be called before being output to the browser. This is similar to the settings of the Header () function. Any cookies sent from the server to the user will be automatically converted into a PHP variable, just like data in GET and POST modes.
If you want to assign multiple values to a single cookie, simply add "[]" after the cookie name. For example:
SetCookie ("MyCookie []", "Testing", time () + 3600 );
Note: If the domain or path on your browser is not the same, the cookie uses the same name to replace the previous cookie. Therefore, for a shopping order application, you may want to keep a counter and send it through cookies at the same time. for example:
Example 5-4. SetCookie Example (Example of setting Cookie)
$ Count ++;
SetCookie ("Count", $ Count, time () + 3600 );
SetCookie ("Cart [$ Count]", $ item, time () + 3600 );
Environment variable
PHP automatically uses environment variables as common variables of PHP. The example is as follows.
Echo $ HOME;/* Shows the HOME environment variable, if set .*/
Since information is transmitted along with GET, Post, Cookie, and other mechanisms, and PHP variables are automatically created, sometimes it is best to read a variable accurately from the external environment to make sure you are using the correct version. The getenv () function does this. you can also use the putenv () function to set an environment variable.
More articles about "php external PHP variables"
Love J2EE follow Java Michael Jackson video station JSON online tools
Http://biancheng.dnbcw.info/php/326450.html pageNo: 13.