Jump to content

GET or POST


shivani.shm

Recommended Posts

There is no 'better' or 'worse', they simply do different things at different times.

 

With get, all variables that are typed into form fields will appear in the URL on the next page. That means that if you have sensitive information, it will be seen. There is also a limit to the number of characters that can be in a URL, so if you have too much information in your form, they wont all fit in get. However, if you have a form and you want people to be able to link to the results, then get is the way to go.

 

With post, the information wont be visible in the URL, so its (a little) more secret. It can also handle a lot more data than GET. However, people wont be able to link to the results of post searches.

Link to comment
Share on other sites

What about $_SESSION? $_GET should only be used when it helps navigation. Like a profile. You use the Get option to extract the id number and output the correct profile. Use Post almost always. $_SESSION should be used be used for data held within a session or a user visit.

 

Hope that helps!

Link to comment
Share on other sites

And to educate you further, use cookies if you want to store preferences. Assume you give them an option to change the BG color, use a cookie to store that BG color value.

 

But don't store passwords, or any important info, can easily be exploited.

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.