Search code examples
phpcookiessend

php how to send get and post and cookie at once?


How to send get&post&cookie at once?

if($_GET[get] && $_POST[post] && $_COOKIE[cookie])
{
   //blah blah
}

How to send get,post,cookie data for that code at once?? give me a sample code please!

I used form tag but couldnt send at once but I don't know how to send it at once


Solution

  • Sounds like you want $_REQUEST - this is by default "An associative array that by default contains the contents of $_GET, $_POST and $_COOKIE."

    Be aware that by using $_REQUEST you lose information about where the variable came from, so it is recommended to use the individual variables, or set $_REQUEST to only contain GET and POST data, with POST overwriting GET: $_REQUEST = array_merge($_GET, $_POST);