Why would you ever use $ _GET in PHP?

I have not officially started learning PHP, just looking through a couple of tutorials and I have a question. Why did someone decide to use Get vs Post? Why do you need the data shown in the url string? I understand that mail is used for passwords and important information, but I do not understand why you will use get, and not just publish all the time?

Thank you for understanding.

+3
source share
6 answers

If you want people to be able to share the link with their friends ... for example, http://example.com/products.php?product_id=12

+17
source

$_GET , - , , . , readonly.

$_POST , , . $_POST , , . , .

prodigitalson : $_POST $_GET , , .

+28

GET . POST .

HTTP, PHP.

+10

? , , GET. , "" , , 90% - :) , , , , , , ;)

+3

() script script -. $_GET.

GET URL- URL- .

0
source

GET can be used for various reasons .. If you want to share the URL with your friend, for example http://site.com/share.php?id=123 <- Often used.

It is often used for dynamic actions.

POST is often used when confidential information should not be used.

You can watch it on google to find out more =)

0
source

Source: https://habr.com/ru/post/1759626/


All Articles