‫Okay.
‫So this is going to be a pretty quick video.
‫This is the request Superglobal.
‫And you can use this in the same way that you can use get post as well as cookie, which we haven't
‫gone over yet.
‫But I'm going to show you some examples.
‫However I wouldn't recommend using request.
‫It's better to use get or post because mixing get and post may lead to unexpected behavior.
‫It can also lead to security vulnerabilities, but I did want to mention it because it does exist and
‫you might see it especially in legacy code.
‫So the first thing I want to do is show you how we can use it to get query params, just like we can
‫with get.
‫So up at the top here, let's say echo and we'll do money sign underscore request.
‫And let's just say name and then we'll use double question mark string.
‫All right.
‫And then let's go over here and let's add question mark name equals whatever Brad.
‫And you'll see when I go to that it it prints it out.
‫Right.
‫So it's the same as if I were to do get if I change that to get and reload.
‫Same thing.
‫Right.
‫But again you want to stick to using get.
‫Now I can also use it in the same way that I use post.
‫So if we come down here and I just change all of these these this money sign underscore posts, so I'll
‫just select them all and change it to request.
‫And then if we come back here and I put something in here and submit, you'll see that it works.
‫So I can get the post data using for instance, request title.
‫But again, you don't really want to be doing this.
‫So.
‫If you use get or post over request, it makes your code more predictable and easier to understand for
‫both you and any developers that work with your code in the future.
‫Additionally, using get and post explicitly reflects the intention of your code, and it makes it clear
‫whether you expect data to be passed via URL or through the request body through the form, whatever.
‫All right, so it just makes your code better overall.
‫So there's very few reasons that I can think actually, off the top of my head, I can't think of any
‫reason to use it.
‫I'm sure there are 1 or 2, you know, some, some weird side cases, but for the most part you're going
‫to want to use post, get and cookie for that matter.