answersLogoWhite

0


Best Answer

$_POST and $_GET are both PHP functions used to extract input from HTML forms. However, the difference is that $_POST keeps the extracted variables hidden from users, whereas $_GET does not. Because of this, there is a major difference between the two functions in terms of security.

Why would you use $_GET at all, then? Because some websites have large databases full of information for the user. For example, say you were shopping online, and you go to buy 2 pairs of pants (item #125). The URL that you are sent to might look like this:

catalog.php?item=125&quantity=2

As you can see, the variables obtained through $_GET are visible to the user.

The POST method has possibility of much volume data sending (usually by the server settings limited) and it may be used unless it represents benefits in comparing GET method. A lot of browser can not correctly bookmark pages which are displayed after HTTP POST method, because the submitted data is displayed in the address bar.

When you need the query string, which is get by GET method using (ineffective by it's limits), you will try to use POST method for your forms. You can use POST method if you submit the important information which shouldn't be displayed in the address bar.

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What are the POST and GET methods in PHP?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the difference between POST and REQUEST methods in PHP?

The $_POST array contains only variables supplied by a form that used the POST method, while the $_REQUEST array combines the $_POST, $_GET and $COOKIE arrays.


What are the correct and the most two common way to start and finish a PHP block of code?

`<?php` then a `?>` and also `<?=` and `?>` are the only compliant methods now that PHP 7 is out.


When using post method in php whether the variable displayed in url?

No, the variables do not form part of the URL visible in the address bar. They only display in GET methods or manually appended.To access POST variables in scripts, you need to use $_POST['variable_name'];


Is php is package?

A package is a mechanism for organizing namespace, constructors, methods and fields. PHP is a technology in itself and contains quite a few packages


What is the role of HTML in php?

HTML is one method by which PHP can output a response. Other response methods are file, database, email, and network (URI).


What are the differences between php get and post methods and which one is the best method to use?

This is very important to get right, for more information, check out w3schools' PHP tutorial. POST is used for password input or the like, it doesn't show the input in the screen. GET is used in general and the input IS shown in the address bar. I'm not that sure of details so check out w3schools, what I found to be one of the best learning resources on the web


How can you execute a PHP script using command line?

2 Methods: 1. You execute your php binary (in linux, make sure you have php-cli installed) and pass the script as an argument. EG ($: /usr/bin/php /home/user/script.php) 2. A sh'bang in the first line of your script, with the full path of your php executable: #!/usr/bin/php -q <?php ScriptStuff(); ?>


Is post modernart a form of abstraction?

In PHP there are two methods POST and GET used to POST a FORM to the server. Abstract is a type of object in PHP. If you will read more on this you will know more on this. May be your question is not clear to us. In this case the answer to the question is Yes and No both. If you say yes it is right, If you say no it is also right. Because there can be two views only on what has been tought/discussed by teachers. In the rest of the cases always there should be only one view. the view of the man who has asked the question.


How do you make a login using PHP?

Create an HTML form with METHOD="post" and ACTION="login2.php". In login2.php check if the entered username and password are correct. You can get the username with $_POST['name_of_username_input']. The same goes for the password.


How do you post the data from an input type checkbox in a form to MySQL tables using PHP?

using the post command.$_POST['checkboxname'];


How many method used to collect values in a form in php?

POST, GET & REQUEST will get the values from a form.


What is an example of HTTP?

Get and Post Methods.