Jump to content
Larry Ullman's Book Forums

Recommended Posts

I'm used to using $_POST to handle my form data. In chapter 2, Mr Ullman states to use $_REQUEST. I did look up $_REQUEST on php.net and it says that it contains data for $_GET, $_POST, and $_COOKIE. Does that mean I no longer need to bother with $_GET or $_POST and just use $_REQUEST going forward?

 

Sorry for the amateur question. I've done some PHP programming in the past and I'm trying to get back into it (hopefully in the correct way).

 

Thank,

James

Link to comment
Share on other sites

Hey! You should use $_POST if you know it's a POST request (the same for $_GET). I expect I use $_REQUEST in Chapter 2 as an easy, foolproof introduction, but will switch to $_POST in due time. Sorry for any confusion!

Link to comment
Share on other sites

$_REQUEST is useful primarily in two situations. First,for debugging purposes, it's easy to dump out this value. Second, if you have a page that could be passed a value via both GET and POST, $_REQUEST makes sense. Most commonly, this would be the ID of an item being updated. 

Link to comment
Share on other sites

 Share

×
×
  • Create New...