Jump to content

$_GET vs. $_POST


Trium918

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.