What are method attributes for? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

What are method attributes for?

Honestly, I am having a hard time analyzing what the method attributes are for. I understand that Get and post have different functions. But for now, as a Digital Marketing Strategist, I do not know where to use it. The courses have limited examples on how it is used, can you please give me an example as to which Get and Post are useful?

5th Feb 2017, 3:38 PM
Gabriel Wilfredo Mattheau “Sunshine” Sunwarrior
Gabriel Wilfredo Mattheau “Sunshine” Sunwarrior - avatar
1 Antwort
+ 1
Hi. The Main difference as i know is that when You send a form with GET as a method, all of the data inside of your form ( lets say the value of some textbox ) Will be send in the URL something like www.example.com/Index.php?control1=value1&control2=value2 and so on.This is different on a POST request since the values of your controls are also send to the server but on the body of the request insted of the URL so a normal user Will not be able to ser what the browser is actually sending. Now when to use it, well it depends mainly on the developer but it is recommend, as far as i now, to use GET only when You consider that sharing the URL to the user would ve usefull and secure for example on a news site so the user can share the note URL anf anybody can access to the note. And about when to use POST, well this kind of method is use when the form is going to modify something on the data base or when You are sending private data on a form for example on a login because if You send a login data inside a GET form all the data Will be displayed on the URL and other users may be able to see a user password on the URL of the website.
7th Feb 2017, 3:08 PM
Esteban Juarez Rodriguez
Esteban Juarez Rodriguez - avatar