•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 391,951 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,850 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 1699 | Replies: 7
![]() |
•
•
Join Date: Jun 2005
Location: Kansas City, Missouri, USA
Posts: 344
Reputation:
Rep Power: 4
Solved Threads: 4
POST vars are more secure because they are not visible in the URL. Also, if you are posting large amounts of text, GET method is not going to work well. I generally only use GET (querystring) method for pages such as a product detail page. I might do something like product_detail.php?id=15. In this case, I like having the ability to directly call the URL for a specific product. Also, I'm very likely to be using the querystring URL in a link. You can't POST in a link. e.g. <a href="product_detail.php?id=15">Daniweb Logo T-Shirt</a>
•
•
Join Date: Jun 2005
Location: Kansas City, Missouri, USA
Posts: 344
Reputation:
Rep Power: 4
Solved Threads: 4
Correct. You probably should always use method="POST". This is not a rule or a policy, just probably usually best and will suit your needs.
You would use method="GET" in a form if you were submitting your form to a third-party who only accepts GET input.
You would use method="GET" in a form if you were submitting your form to a third-party who only accepts GET input.
•
•
Join Date: Jun 2005
Location: Kansas City, Missouri, USA
Posts: 344
Reputation:
Rep Power: 4
Solved Threads: 4
Good point, Rashakil Fol.
•
•
Join Date: Jun 2005
Posts: 9
Reputation:
Rep Power: 0
Solved Threads: 0
GET methods also makes it easier for someone to bookmark a page. And your users don't get the annoying "This page contains POST data (...) when they try to use the back and forward buttons in their browser. Also, GET don't need a form (or javascript cheating) - you can easily print out dynamic url-s like "www.somedomain.com/product.php?id=116" in your php scripts, and people can just follow the links, with no need for form handling, which is neat.
General rule of thumb: Use get for pages that views stuff and POST for pages that change stuff. For instance, you don't want an URL a la "www.somedomain.com/products/raiseprice.php?rate=10%", because if someone calls this page twice, they will change the price twice.
Also, information that you would like to be secret should not occur in url's. For instante, don't go "www.somedomain.com/login.php?user=admin&password=adminpass". That's piece of cake to hack, and you don't waht that to happen
Hope this cleared things up.
- Karianne
General rule of thumb: Use get for pages that views stuff and POST for pages that change stuff. For instance, you don't want an URL a la "www.somedomain.com/products/raiseprice.php?rate=10%", because if someone calls this page twice, they will change the price twice.
Also, information that you would like to be secret should not occur in url's. For instante, don't go "www.somedomain.com/login.php?user=admin&password=adminpass". That's piece of cake to hack, and you don't waht that to happen

Hope this cleared things up.
- Karianne
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
Similar Threads
- Quick Question: Is J# the same thing as Java? (Java)
- Simple array question (C++)
- This has to be a simple question to answer. (Visual Basic 4 / 5 / 6)
- Ribbon Question (Motherboards, CPUs and RAM)
- Simple question (Windows Servers and IIS)
- Simple Question (Linux Servers and Apache)
- A simple question about CMOS batteries (Motherboards, CPUs and RAM)
- XP Pro (re)activation question (Windows NT / 2000 / XP / 2003)
Other Threads in the PHP Forum
- Previous Thread: Relative Paths and Subdomains
- Next Thread: Image croping algorithm?



Linear Mode