Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

PHP Build a Basic PHP Website (2018) Building a Media Library in PHP Working with _GET Variables

[SOLVED] The $_GET variable does not set up in the browser!

For example when i press on books it just goes to catalog.php, not catalog.php?cat=books and i did all that was done in the video please help me!

Jeff Lemay
Jeff Lemay
14,266 Points

Post your code here so we can take a look.

thanks but i found my solution

Jeff Lemay
Jeff Lemay
14,266 Points

Awesome. Would you mind posting your solution as an answer below so the question can be marked as resolved?

added [SOLVED] to title

1 Answer

jason chan
jason chan
31,008 Points
// catalog.php
<?php 
$pageTitle = "Full Catalog";
if ($_GET['cat'] == "books") {
$pageTitle = 'Books';
} else if ($_GET['cat'] == "movies") {
$pageTitle = 'Movies';
} else if ($_GET['cat'] == 'music') {
$pageTitle = 'Music';
}

include("inc/header.php"); ?>

<div class="section page">
    <h1>Full Catalog</h1>
</div>

<?php include("inc/footer.php"); ?>

Don't forget to CTLR-S