pedritoalfonso
pedritoalfonso

Reputation: 183

How to display content based on the URL

I'm learning PHP and MySQL and I have a question. I've seen that a lot of sites use this, for example:

http://www.example.com/index.php?product_id=8

or

http://www.example.com/index.php?cattegory=headphones

If you change the values in the URL, the content the page displays changes, so I would like to know how to use that in my webpage, thanks!

Upvotes: 0

Views: 1766

Answers (1)

Sebastian P.
Sebastian P.

Reputation: 878

You can check for the GET parameter included in the url...

if($_GET['product_id' == 8]) { ... }

Upvotes: 1

Related Questions