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

Share this post


Link to post
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!

Share this post


Link to post
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. 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...