You are invited to Log in or Register a free Frihost Account!

Get Post or Request?

Get, Post or Request?

what is the difference and wich one should i use if i want to make a login page?

also, on a different note, when you submit a form, is there anyway to make it not reload, but change the page?
For a login form I would advise using the POST method, just because it's safer.
And it's possible to make your page change instead of reloading but you'll have to use javascript for that. Just search around a bit on these forums looking for AJAX, you'll find what you're looking for.
I guess it's about security. POST is used if the service associated with the processing of a form has side effects.

Maybe finding an equivalence between CRUD and HTTP Verbs, we have:


Although we have four verbs , PUT and DELETE aren't implemented in the majority of browsers.

Hope it helps.
With the get method, the form data is appended to the URL which is bookmarkable.
With the post method the form data is after the http header in one of 2 formats.

If the filled out form could result in over 2k of info you need to use method="post" (mostly because of IE as IE can't handle URLs that long)
If you want the users to be able to to be bookmark the resulting page use method="get"

The easy way to submit a form and not make it goto a new page is to submit the form the good old ajax way.
General practise, you would use GET for something that is bookmarkable and reviewing your form contents (on address bar) won't be an issue: This adds some point in accessibility.

Reverse for POST.

morfeusman wrote:
...also, on a different note, when you submit a form, is there anyway to make it not reload, but change the page?

Yes it is possible, and it's call ajax Wink
Stubru Freak
You also have HEAD, TRACE, OPTIONS and CONNECT, besides GET, POST, DELETE and PUT.
Only HEAD, GET and POST are commonly used for normal web pages. HEAD and GET aren't supposed to change the state of the website, POST is.
POST is the secure one because none of the input in a form are shown in the address bar of the browser but in GET we can see the inputs directly.
the zephyrus
GET and POST the names are really suggestive of what they're intended for.
On one hand, you GET the contents of some information, presumably that will still be there later.
Whereas, you POST your data to some place, and you would not want to do it again by accident.
Some advice is that only POST should modify any state in your application.
albuferque reply has helped me nicely to comprehend,
I'll use POST now for my login
i rarely use Request
for login, i just use post
for anything else that no need security, i use get
Related topics
Yahoo 360*/MyWallop/Orkut/Gmail Every Invitation You need!
Adding field to message data
Upload a preset file using PHP
Firefox Search Plugin
50fri$ Please help me with curl.
making URL stay the same
upload image through PHP AND AJAX
php upload problem
Transfer data between pages on different servers?
301 Redirection
simplest method to 'post' via js
Two validations process
server access, PHP vs AJAX
Be HERO or take ZERO (WIN 60 COINS)
How to achieve 2 actions on html form "submit"
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

© 2005-2011 Frihost, forums powered by phpBB.