Trium918 Posted May 17, 2007 Share Posted May 17, 2007 I havn't writting a script yet where $_GET is needed. Every script that I've writting has been straight forward. To me, there is no need for it as of yet. What does $_GET do that $_POST cannot do or the other way around? When should I use $_GET or $_POST? Quote Link to comment https://forums.phpfreaks.com/topic/51833-_get-vs-_post/ Share on other sites More sharing options...
Garath531 Posted May 17, 2007 Share Posted May 17, 2007 $_GET sends the information through the url, a security risk for somethings, but not for others. If you have an add on to the url (?do=), use get to retrieve it. ($_GET['do']). Does that explain things? Quote Link to comment https://forums.phpfreaks.com/topic/51833-_get-vs-_post/#findComment-255422 Share on other sites More sharing options...
nesiak Posted May 17, 2007 Share Posted May 17, 2007 This helped me > http://www.w3schools.com/php/php_get.asp Quote Link to comment https://forums.phpfreaks.com/topic/51833-_get-vs-_post/#findComment-255423 Share on other sites More sharing options...
Trium918 Posted May 17, 2007 Author Share Posted May 17, 2007 Thanks to both! I need for someone to go more in depth with this topic. Ok, the variables are sent to the URL then what? How would one benefit from the variables in the URL? Quote Link to comment https://forums.phpfreaks.com/topic/51833-_get-vs-_post/#findComment-255465 Share on other sites More sharing options...
Psycho Posted May 17, 2007 Share Posted May 17, 2007 Well, let's say you have a page that lists several different music albums and you want each record to be a link to a page which shows the detail of that item. You can't use post, you would need to use get: href="albumdetails.php?albumid=4" You can't do that with POST. POST's big advantage is it is hidden from the user. Quote Link to comment https://forums.phpfreaks.com/topic/51833-_get-vs-_post/#findComment-255494 Share on other sites More sharing options...
Trium918 Posted May 17, 2007 Author Share Posted May 17, 2007 Well, let's say you have a page that lists several different music albums and you want each record to be a link to a page which shows the detail of that item. You can't use post, you would need to use get: href="albumdetails.php?albumid=4" You can't do that with POST. POST's big advantage is it is hidden from the user. What about a photo ablum? Would the $_GET method be used. Similar to Myspace photo abum. Quote Link to comment https://forums.phpfreaks.com/topic/51833-_get-vs-_post/#findComment-255542 Share on other sites More sharing options...
Nameless12 Posted May 17, 2007 Share Posted May 17, 2007 The only difference worth talking about when it comes to GET vs POST is that GET is usually limited to 255 chars if I remember correctly. POST on the other hand has no limit. There are some cosmetic differences as GET is visable why POST isnt, but no this does not mean one is more secure then the other like someone stated earlier in this post. It is as easy to inject POST data as it is to inject GET Quote Link to comment https://forums.phpfreaks.com/topic/51833-_get-vs-_post/#findComment-255625 Share on other sites More sharing options...
dj-kenpo Posted May 17, 2007 Share Posted May 17, 2007 get is useful if you want people to frequent certian sections of your site. like for instance be able to tell a friend about a specific photo. using post, they'd have to say click this then that, then that, then this. much like annoying flash garbage that has nothing in the url. get = friendly (soemtimes messy and unfriendly) urls so people can bookmark specific pages. Quote Link to comment https://forums.phpfreaks.com/topic/51833-_get-vs-_post/#findComment-255634 Share on other sites More sharing options...
Psycho Posted May 17, 2007 Share Posted May 17, 2007 Well, others have pointed out different benefits and drawbacks between the two. They are different and you need to determine how you are going to implement something to determine which to use. Here is a rundown of what was stated so far: GET has a character limit POST does not (or at least it is much larger) GET variables are visible to the user POST variables are not Note: a novice user can easily "inject" values into the query string whereas POST values can be injected by someone with a modicul of HTML knowledge Using GET variables to display a dynamic page allows the user to create a direct link to the detail page. With POST variables to determine the content of a variable page you cannot create a direct link. The user would have to go to the page where they choose the appropriate optioins on the form. As to your question: What about a photo ablum? Would the $_GET method be used. Similar to Myspace photo abum. Yes, typically I see get used with photo albums. You *could* use POST, but then you would most likely need to add javascript and end up making it more complicated. Quote Link to comment https://forums.phpfreaks.com/topic/51833-_get-vs-_post/#findComment-255726 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.