Warrior Forum - The #1 Digital Marketing Forum & Marketplace

Warrior Forum - The #1 Digital Marketing Forum & Marketplace (https://www.warriorforum.com/)
-   Programming (https://www.warriorforum.com/programming/)
-   -   Which is the difference between $_get & $_post in PHP? (https://www.warriorforum.com/programming/878528-difference-between-_get-_post-php.html)

aircompressor007 10th December 2013 09:57 AM

Which is the difference between $_get & $_post in PHP?
 
I want get the difference please tell actual

mojojuju 10th December 2013 08:02 PM

Re: Which is the difference between $_get & $_post in PHP?
 
There's some good answers here: http://stackoverflow.com/questions/1...n-get-and-post

XTractor 11th December 2013 06:51 AM

Re: Which is the difference between $_get & $_post in PHP?
 
GET is the data sent to the server in the URL:
For example:
SOMETHIGN.com?a1=data&a2=moredata

so the server get's the array: [a1=>data, a2=>moredata]

Post is data sent through the HTTP and it is not visual to the user.

pawanzz 12th December 2013 12:11 AM

Re: Which is the difference between $_get & $_post in PHP?
 
Hello
The basic difference between $_get and $_post is
In the $_get method is restricted to send upto 1024 characters only and the PHP provides $_get associative array to access all the sent information using GET method.Other hand $_Post method does not have any restriction on data size to be sent and the post method can be used to send ASCII as well as binary data.The PHP provides $_Post associative array to access all the sent information using POST method.

rogerlegend 23rd December 2013 06:25 AM

Re: Which is the difference between $_get & $_post in PHP?
 
$_GET, $_POST and $_REQUEST all these variables are predefined variables in php. Normally we have 2 methods to send the data to one page to another page. Those methods are nothing but GET and POST methods. Using this variable we can get the data by specifying the variable name for example, $_GET['name'], $_POST['email'] and $_REQUEST['phone'].

Using GET method:
we can get the data from URL
Example: www.example.com/index.php?name=phptag
Now from the above URL if you want to get the phptag value see the code below

<?php

$name = $_GET['name'];
//or
$name = $_REQUEST['name'];

?>

Using POST method:
we can get the in hidden mode, that means we cannot see the data in URL it will carry through the headers.
Normally we can use the post method by implementing the html form's see the code below

<form name='phptag' method='post'>
<input type='text' name='name' value='phptag'>
<input type='submit' name='demo' value='Click' >
</form>
<?php

$name = $_POST['name'];
//or
$name = $_REQUEST['name'];

?>
Please visit connected commerce site have used lot of post and get methods.
In the above examples the common thing that we have used is $_REQUEST which means it can be used for both GET and POST methods to get the data.

softwarewarden 23rd December 2013 07:10 AM

Re: Which is the difference between $_get & $_post in PHP?
 
Quote:

Originally Posted by rogerlegend (Post 8809150)
$_GET, $_POST and $_REQUEST all these variables are predefined variables in php. Normally we have 2 methods to send the data to one page to another page. Those methods are nothing but GET and POST methods. Using this variable we can get the data by specifying the variable name for example, $_GET['name'], $_POST['email'] and $_REQUEST['phone'].

Using GET method:
we can get the data from URL
Example: www.example.com/index.php?name=phptag
Now from the above URL if you want to get the phptag value see the code below

<?php

$name = $_GET['name'];
//or
$name = $_REQUEST['name'];

?>

Using POST method:
we can get the in hidden mode, that means we cannot see the data in URL it will carry through the headers.
Normally we can use the post method by implementing the html form's see the code below

<form name='phptag' method='post'>
<input type='text' name='name' value='phptag'>
<input type='submit' name='demo' value='Click' >
</form>
<?php

$name = $_POST['name'];
//or
$name = $_REQUEST['name'];

?>
Please visit connected commerce site have used lot of post and get methods.
In the above examples the common thing that we have used is $_REQUEST which means it can be used for both GET and POST methods to get the data.

not 100% correct $_REQUEST = data from $_GET, $_POST, and $_COOKIE

YHmuWong 23rd December 2013 07:30 AM

Re: Which is the difference between $_get & $_post in PHP?
 
It is mostly how the script reacts to the data.$get is pass it as visual to the user while $post is to pass it as http and hidden to the user.Obviously,$post is safer than $get protocol, who wants their information being posted on the site they visit.

Andrew H 24th December 2013 10:10 AM

Re: Which is the difference between $_get & $_post in PHP?
 
It amazes me how much people 'think' they know (and how positive they seem in their answers). ~%20 of information in these responses is incorrect.

$_GET = PHP: $_GET - Manual
$_POST = PHP: $_POST - Manual
$_REQUEST = PHP: $_REQUEST - Manual

nettiapina 25th December 2013 02:35 AM

Re: Which is the difference between $_get & $_post in PHP?
 
Quote:

Originally Posted by YHmuWong (Post 8809257)
It is mostly how the script reacts to the data. is pass it as visual to the user while is to pass it as http and hidden to the user.Obviously, is safer than protocol, who wants their information being posted on the site they visit.

POST is not much safer than GET unless there's something else to make it safer. You're still POSTing information to the site you're visiting. It's all in clear text unless you're using some form of encryption.

Sure, the variables aren't visible in your address bar, and it might be harder to get the data from your browser history, but these are just side effects.


All times are GMT -6. The time now is 02:54 PM.