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 Build a Simple PHP Application Integrating with PayPal Building the Shirt Details Page

Broken images

I been trying to display images but the image path seems invalid.My code is following

include("product.php");
$pageTitle = "Shirt Description";
include("header.php");

$product_id = $_GET['id'];
$product = $products[$product_id];
//var_dump($product);
?>
<h1></h1>
<img src="<?php echo $product['img']; ?>" alt="<?php echo $product['name'];

Upon inspecting the value of the output. The link gives http://localhost/shirts4mike/inc/img/shirts/shirt-102.jpg

which is wrong, as the pictures aren't in /inc but in /img and my directory structure is same as the author. Where am i going wrong?

1 Answer

Try inspecting the image from the web browser and following the link it gives that may give you some insight. Also check for any console errors.

The PHP looks good as long as your sure the id is being passed as a GET variable. You always download the code and paste the instructors in and see if it works, if it does theres a flaw somewhere.