Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP Enhancing a Simple PHP Application Paginating a List: Controller Retrieving the GET Variable

Atiba Lashley
Atiba Lashley
5,724 Points

$_GET["pg"]; is underfined

So I'm following along with the lesson and I'm having an issue with the page the page numbering. He is my code:

if(empty($_GET["pg"])){ $current_page = 1; } $current_page = $_GET["pg"];

    echo $current_page;
    exit;

    $products = get_products_all();

It keeps saying "Notice: Undefined index: pg...."

1 Answer

looks like you're missing your else statement.