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 trialMin Chin
401 Pointsdetails page wont show up.
Im trying to load to my localhost http://localhost:8888/details.php?id=101, but it wont show up. Is there anything wrong with my code?
<?php
include("inc/data.php");
include("inc/functions.php");
if (isset($_GET["id"])) {
$id = $_GET["id"];
if (isset($catalog[$id])) {
$item = $catalog[$id];
}
}
if (!isset($item)) {
header("location:catalog.php");
exit;
}
$pageTitle = $item["title"];
$section = null;
include("inc/header.php"); ?>
<div class="section page">
<div class ="wrapper">
<div class="media-picure">
<span>
<img src="<?php echo $item["img"]; ?>" alt="<?php echo $item["title]; ?>" />
</span>
</div>
</div>
</div>
1 Answer
Min Chin
401 PointsYour awesome Andrew. Its working now.
Joy Manuel
6,464 PointsReviewing line by line and comparing really does help. I had the same issue, it was a simple syntax error, details.php?id=101 works now. I was missing $ in $id. Thanks Adam.
Adam Sommer
62,470 PointsAdam Sommer
62,470 PointsI think you have a typo on this line:
<img src="<?php echo $item["img"]; ?>" alt="<?php echo $item["title]; ?>" />
Check your double and single quotes maybe.