These are the form action method for submitting html or php forms. However, now GET method is also used for url rewriting. POST method is more secure and GET is fast.
When writing a form in HTML, these are the two different methods for sending data to the PHP file that will process the form. When using a "POST" as the method in your form tag, the data will be sent to the PHP file as a POST variable. For example, here is a HTML file, form.html, which includes a simple form with one field. The form has been set to send the data using the "POST" method. Form.html: <html> <head> <title>Test Form</title> </head> <body> <form action="process.php" method="post"> <label for="name">Name:</label><input type="text" name="name" /> <input type="submit" name="submit" value="submit" /> </form> </body> </html> HTML: We then have the PHP file, process.php which will receive the variables and retrieve them using the $_POST['varname'] method. Process.php: <?php if($_POST) { //Retrieve POST variables $name = $_POST["name"]; //You would then do further PHP coding here to use that variable, for now i will just echo it echo $name; } else { echo "Post not received."; ?> PHP: That is a very simple code example of the PHP "POST" method. If you were to be using the "GET" method, your variables will be shown in the URL. For example, if we sent the same for using the "GET" method the URL would look like... http://www.yourwebsite.com/process.php?name=NAMEENTERED This method is not ideal for processing forms that have to do with logging in or any other type of personal information, as all of the information is revealed in the URL. In the case that you use the GET method, the only thing that will change in your code is here: $name = $_POST["name"]; PHP: Would be: $name = $_GET["name"]; PHP: I hope that helps explain the two different types and how to use them a little bit. -Brett
Post used to store data and more secure.. Get mostly used for URLs query. you cannot use POST to navigate and view this page http://www.sample.com/?name=asd GET is also used to create URLs and dynamic pages. its fast not secure most of hackers use GET variables to attack the website.
when dealing with forms and also to transfer data from one page to another one, you basically need to use either a GET or POST request. GETs are explicit requests, so that when you load the other page the suer is able to see what the data is (i.e. whenever you see &, ?, = in the website URL there's been a GET request. You can access GET data with $_GET['id'] to get everything after id in the URL and so on POSTs are somewhat more reserved requests, as data is not visible by the user. When you reload a page and are asked to rePOST your data, there's been a POST sometime before you accessed that page. similarly to GETs, you access POST variables with $_POST['id']
GET and POST both transfer information to a URL. GET can be used at the end of a URL like example.php?user=MailPropeller&password=NoneOfYourBusiness They can both be used in <form> tags to by setting method="post" or method="get" If you want security use https.
I just came across this thread, and couldn't help but appreciate BrettOwnz for taking so much time in writing such a detailed post.
anyone can access GET variables from any simple browser. unlike POST you need to use special tool to access POST variables. like CURL.. thats my opinion and thats how I see it..
@xenon2010 Couldn't agree, Curl is software that acts like a "real browser" in command-line scenario. LibCurl very well replaces real browser in server side scripting, allowing to GET/POST/use cookies/get cookies and so on. What's being POSTed can be seen from page's source code. To see what's really posted, use SmartSniff. To modify what's being posted, use FireBug under FireFox.