0

In which condition we can use $_REQUEST variable instead of $_GET or $_POST variable. I confused about when use $_request variable because this can be used for both uses of $_get and $_Post variable . So please me help me..

Thank you in advance...

Mahi143
  • 15
  • 3
  • 1
    DUPLICATE - http://stackoverflow.com/questions/368329/php-using-get-post-instead-of-request?rq=1 and http://stackoverflow.com/questions/1924939/php-request-vs-get-and-post?rq=1 – DevlshOne Jul 09 '13 at 14:43
  • 1
    When you ask a question like this, if you'll look in the bottom - right quadrant of the page, you will see **Related** questions that probably have the answer. – DevlshOne Jul 09 '13 at 14:45
  • yes dude !.. i apreciate with you all .. But i couldn't understand it .. that's why asking.. ! and i hope you will undestand me.. – Mahi143 Jul 09 '13 at 14:51

3 Answers3

1

$_REQUEST, by default, contains the contents of $_GET, $_POST and $_COOKIE.

But it's only a default, which depends on variables_order ; and not sure you want to work with cookies.

I would not use $_REQUEST,I choose $_GET or $_POST depending on application

You should use $_GET when someone is requesting data from your application. And you should use $_POST when someone is pushing (inserting or updating ; or deleting) data to your application.

sourabh kasliwal
  • 947
  • 3
  • 8
  • 21
0

The short answer is: Always use $_GET or $_POST. $_REQUEST is synonymous with either but detracts from being a diligent, strict coder.

DevlshOne
  • 8,357
  • 1
  • 29
  • 37
0

$_REQUEST is not that bad but what if you are getting data from $_COOKIE and hackers send that with $_GET?? your saved value in cookie will be of no value then. SO, always always use $_GET, $_POST, $_COOKIE respectively..

Ahmed Habib
  • 189
  • 11