PHP Query Parameters

Video loading...

Join Drupalize.Me to watch this video

Join today and gain instant access to our entire video library.

Log in Sign up
  • 0:05
    with Leanna Pelham
  • 0:09
    It's time to give each pet their very own page.
  • 0:12
    At this stage, a new page means a new file,
  • 0:15
    so create a show.php file, and copy in the require statements
  • 0:19
    for functions.php, the header and the footer.
  • 0:26
    Every page file is a familiar pattern.
  • 0:28
    We do some work at the top like querying the database,
  • 0:31
    and then we use the variables we created in the rest of the HTML
  • 0:35
    to print things.
  • 0:36
    Here, our work will be to query for only one pet in the database,
Loading ...

PHP Query Parameters

Loading...

In this tutorial we're going to create pages for each of our pets by using a query parameter. This is a bit of code that is added to the end of a URL to pass information to PHP. They look something like ?id=23. On the PHP side of things we'll use the $_GET superglobal variable to pull that data into our code.

Downloads: 
Log in or sign up to download companion files.

Additional resources:
There are no resources for this video. If you believe there should be, please contact us.