0

I am a beginner in php, I noticed there is a third method for passing the form by using the $_REQUEST method.So can somebody please tell me how to use this and what is the difference compared to the other two method.Also out of all three which one is more secured to use for developing a log in page.Because on some website it said it is not recommend to use $_REQUEST I am not sure why.Really appreciate thanks.

  • 1
    Be sure to [read the official documentation](http://www.php.net/manual/en/reserved.variables.request.php) on `$_REQUEST` – Michael Berkowski Aug 08 '13 at 23:50
  • [This question](http://stackoverflow.com/questions/368329/php-using-get-post-instead-of-request) – Chris Brown Aug 08 '13 at 23:50
  • `$_REQUEST` is a mixture of `$_GET` and `$_POST` nowadays. It was widely discouraged because of `$_COOKIES` being also piled in in previous php.ini defaults. The issue being cookie fixation issues (often portrayed as security issue, mostly an inconvenience truly.) – mario Aug 08 '13 at 23:50

1 Answers1

1

$_GET is for when your form uses method=get and $_POST for when it uses method=post.

Get puts the variables in the URL where they can be seen in the address bar. Post does not.

$_REQUEST is an array containing both the GET and POST parameters, and also cookies.

http://php.net/manual/en/reserved.variables.request.php

developerwjk
  • 8,619
  • 2
  • 17
  • 33
  • little simplistic, you don't need a form to parse values using either get or post –  Aug 09 '13 at 01:22
  • I consider it 99.9% likely that someone who doesn't know the difference between them is using a form, and now that I think about it, probably without specifying method. – developerwjk Aug 09 '13 at 19:59