Lelin posting php t. Related ties: husband, wife, father-in-law, mother-in-law, cooler, mother-in-law, girl, Schurin, Cola, Sweet, shank, son-in-law, daughter-in-law, Snow. Transmission of variables in PHP using the POST method

  1. Husband (spouse) - A man in relation to a woman who is married
  2. Wife (spouse) - A woman in relation to a man with whom it is married. Married woman.
  3. Text - Father of his wife
  4. Much - Mother of his wife
  5. Svetoch - Father of her husband
  6. Svetrov - Mother of her husband
  7. Leller - Brother husband
  8. Shurin - brother-in-law
  9. Zolovka - husband's sister
  10. Sweet - Husband Husband
  11. Pobedaenitsa - Sister of wife
  12. Son-in-law - husband's husband, husband sisters, Zolovka husband
  13. Daughter-in-law - Brother's wife, Son's wife for his mother, wife of one brother in relation to the wife of another brother; Also used instead of a tree, sinking, sly
  14. Snow - Son's wife in relation to the Father
  15. Matchmaker - Father of one of the spouses in relation to parents of another
  16. Sitting - the mother of one of the spouses in relation to the parents of another
  17. Grandfather (grandfather) - Father father or mother.
  18. Grandmother (grandma) - father father or mother.
  19. Cousin - Uncle Father or Mother.
  20. Great-aunt - Aunt Father or Mother.
  21. Grandson, granddaughter) - Son (daughter) daughter or son towards grandfather or grandmother. Accordingly, the cousin grandson (granddaughter) - the Son (daughter) of the nephew or niece.
  22. Halt-nephew (niece) - Grandson (granddaughter) of brother or sister.
  23. Uncle (Uncle, Uncle) - Father's brother or mother, husband aunt.
  24. Aunt (Aunt, Aunt) - Sister of father or mother in relation to nephews. Uncle's wife in relation to his nephews.
  25. Nephew niece) - Son (daughter) of brother or sisters (relatives, cousins, secondary). Accordingly, the child of the cousin (sisters) is a cousin, a secondary brother (sister) - a second-class nephew.
  26. Single-util (brother, sister) - having a common mother.
  27. Single (brother, sister) - Having a common father, but different mothers.
  28. Summary (brother, sister) - Who are brother (sister) by stepfather or stepmother.
  29. Cousin - Son of native uncle or native aunt.
  30. Cousin- Daughter of native uncle or native aunt.
  31. Second cousin - Son of cousin uncle or cousin.
  32. Second cousin - Daughter of cousin uncle or cousin.
  33. Kum, Kuma- The godfather and mother in relation to the parents of the godfish and each other.
  34. Stepfather - Mother's husband in relation to her children from another marriage, a NOTOR father.
  35. Stepmother - Father's wife in relation to his children from another marriage, a non-Votor mother.
  36. Stepson - Near son of one of the spouses who comes with his own other spouse.
  37. Stepdaughter - The rude daughter of one of the spouses coming to his own other spouse.
  38. Reception Father (Mother) - Adopted, having fascinated anyone.
  39. Reception Son (daughter) - Adopted, adopted by someone.
  40. Adopted son-in-law - The son-in-law adopted in his wife's family living in the house of his wife.
  41. Widower - A man who has a wife died.
  42. Widow - A woman who has died husband.
  43. Potility - Brothers, mostly cousins, friends who had the opportunity to cut down each other in difficult times.

So, we again continue to study the foundations of PHP and in this article will get acquainted with the methods of transmitting variables in PHP, namely gET and POST methods. Each of them has its pros and cons, and applies in the appropriate situations, which will be discussed in this article. We will also consider examples of code that demonstrate the work of POST and GET methods.

Transfer of variables using the GET method

This method of transmitting variables is used in PHP to transfer variables to a file using the address string. That is, variables are transmitted immediately through the address bar of the browser. An example may be, for example, a link to the WordPress article without using CNC (SEF), which has about the following type:

Https: // Site /? P \u003d 315

That is, in this case, the variable $ p is transmitted with the value 315. Now let's look at the example of the example of the GET method. Let us need to pass into the file three variables $ a, $ b and $ c gET.and withdraw their amount on the screen. To do this, you can use the following code.

$ a \u003d $ _get ["a"]; $ b \u003d $ _get ["b"]; $ C \u003d $ _GET ["C"]; $ Summa \u003d $ A + $ B + $ C; Echo "Amount $ A + $ B + $ C \u003d $ Summa";

Since all variables before transfer will be placed in global Massif GET. (), then we first assign the values \u200b\u200bof the corresponding elements of the GET array. We do it at the very beginning to avoid diverse errors in transmitting variables. Next, to demonstrate the work, we prescribe an arbitrary formula and display the result on the screen.

To check the work of the GET method just add to the link to the file sign "?" And through the ampersand "&" list variables with their values. Let us have a file get.php.which lies in the root of the site. In order to pass into the file variables, it is enough to register in the address bar the following.

Https: //syt/get.php? A \u003d 1 & b \u003d 2 & c \u003d 3

As can be seen from the example, first we add a question mark immediately after the file name. Next, we prescribe a variable and simply indicate its value. After that, over the ampersand, lists other variables in the same way. Now, when switching to this link, we will withdraw the amount of variables $ a, $ B and $ c.

This method is very simple and does not require the creation of additional files. All the necessary data comes directly through the browser's address bar.

Well, now let's move on to the second method of transferring variables in PHP - pOST method.

Transmission of variables in PHP using the POST method

This method allows you to be hidden to transmit variables from one file to another. As you already understood, usually two files are used for these purposes. The first is the form for entering the source data, and in the second executive file that takes variables. For a demonstration, let's look at the following code.

The code of the first file with the form for sending data. Let him name post-1.php

  • action - specify the file to which variables will be transmitted.
  • method - method of transferring variables. In our case, this is the POST method.
  • name - the name of the form. At the same time, a variable with the same name will be transmitted to the file.

Text fields:

  • name - variable names. In our case, this name and surname (variables of Name and LastName).
  • type - Field type. In our case, this is a text field.
  • name - the name of the button and the variable that will be transmitted along with other variables.
  • type - button type. In our case, this is a button to send data.
  • value - text on the button.

The code of the second file that will serve as a receiver of variables. Let's call it post-2.php

$ name \u003d $ _post; $ LastName \u003d $ _Post; echo "values \u200b\u200bof variables transferred by the POST - $ Name and $ LastName method";

As with the GET method, we first assign the variable values \u200b\u200bof the corresponding elements global MassivaPOST.. Next, for clarity, we display these variables on the screen using.

Now, when you download the first file, we will boot the form. After entering the data, click on the "Submit" button, with the result that in the new tab we will open the page with the second file on which the values \u200b\u200bprescribed in the form on the previous page will be displayed. That is, the second file will be transmitted values \u200b\u200bof variables from the first file.

This article about the transfer of variables in PHP approached the end. If you do not want to miss the appearance of other articles on the blog, I recommend subscribing to the newsletter by any convenient way in the "Subscription" item or use the form below.

That's all. Good luck and success in mastering the foundations of PHP.


One of the most important and popular tasks in PHP - data transmission. You probably came across the URL like site.ru/page.php?id\u003d114841 or shape with input fields Text (registration, new comment, etc.). In this and the following lessons, let's talk about data transfer to PHP.

PHP PHP method

The method consists of two parts: HTML with form and fields and handler files on PHP.

Attention! To work, we sufficiently create accordingly total two files.

Demonstration Download source
Consider an example with comments - Implementation of user authorization on the site:

HTML code (POST.HTML file)



The form





Your login:

Your password:







Now more about data transfer methods. There are two types of GET (via URL, open - you can change the URL manually) and the post (via form, closed). The difference will be in the content of the address string, that is, the URL.

When receiving data transferred to one of these methods into an array of the corresponding method of type ($ _Get or $ _Post), data are collected. There is also an array of $ _request, which can contain and $ _get, and $ _post at the same time. But this is for other examples. I recommend most of the data to the POST method.

Now consider the handler code.

PHP code (in the Test_reg.php file)

$ login \u003d $ _post ["login"]; // accept the data sent post
$ pass \u003d $ _post ["Pass"]; // Login and Pass is NAME input fields

If (($ login \u003d\u003d "admin") && ($ pass \u003d\u003d "pass"))
Echo "Hello, Admin! Today coffee or tea?)";
ELSE ECHO "You have entered an incorrect ligament login password. Try more Back";
?>
You can see how in separate variables we record the value of the fields with the corresponding Name in the $ _Post array, although it was also possible to collect in $ _request.

In the handler, perhaps, we work out the authorization condition - whether the login and password match the form with our fictional (according to Admin and Pass). And either say hello with the incoming (Hello, Admin! Today, coffee or tea?), Or not (you have entered an incorrect ligament login password. Try more). However, to create a full-fledged authorization, you still have to get acquainted with cookie, sessions and. But about this later.

Directly in the script you can handle the data: add, washed, encrypt, and so on. The main thing is to know the name of the variable (set in HTML form) and then collect them using the $ _Post, $ _Get and $ _request arrays.

Thanks for attention!

Did you like the article? To share with friends: