Author Topic: $_REQUEST  (Read 235 times)

Chris

  • New Member
  • *
  • Posts: 15
  • Karma: +1/-0
    • View Profile
$_REQUEST
« on: February 03, 2012, 07:24:13 PM »
Hello,

Does: $_REQUEST['______'] have the same basic function as $_POST['______'] and or $_GET['______'] ?

If not, what does $_REQUEST specifically do?

If all three listed above are basically the same, what are the differences?

I've been searching $_REQUEST but can't seem to find threads that expound on it.

Thanks in advance.
Chris

Smokey PHP

  • Web Developer
  • Expert PHP Helper
  • Senior Member
  • *****
  • Posts: 529
  • Karma: +5/-0
    • View Profile
Re: $_REQUEST
« Reply #1 on: February 04, 2012, 09:16:25 AM »
POST and GET are both types of HTTP requests. Yes, the $_REQUEST variable contains both $_POST and $_GET elements. The use of this is frequently frowned upon for many usages however, due to security issues (if you use $_REQUEST to get information from a form which you've set to use the POST method, someone could just add all the information as GET parameters and your code would still work and take their values).

More in-depth info at the PHP manual page for REQUEST

Chris

  • New Member
  • *
  • Posts: 15
  • Karma: +1/-0
    • View Profile
Re: $_REQUEST
« Reply #2 on: February 07, 2012, 04:40:48 PM »
Thanks, Smokey!

Great info about the security issue.

Much appreciated.

Chris