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

Simon Tucker
Simon Tucker
9,113 Points

having trouble displaying the image in shirt.php it is passing through ok with the alt attribute displaying.

shits4mike example

Hi - show the code in your <div class="shirt-picture">

here is mine (split up for legibility), but it is from a later chapter where the URLs are cleaned up.

<div class="shirt-picture">
<span>
<img 

src="<?php echo BASE_URL . $product["img"]; ?>" 
alt="<?php echo $product["name"]; ?>"

>

</span>
</div>
Simon Tucker
Simon Tucker
9,113 Points

?php include ("inc/products.php");

$product_id = $_GET["id"]; $product = $products[$product_id];

$section = "shirts"; $pageTitle = $product["name"]; include("inc/header.php"); ?>

    <div class="section page">

      <div class="wrapper">

        <div class="breadcrumb"><a href="shirts.php">Shirts</a> &gt; <?php echo $product["name"];?></div>

        <div class="shirt-picture">

          <span>
            <img scr="<?php echo $product ["img"]; ?>" alt="<?php echo $product["name"]; ?>">
         </span>

        </div>

      </div>


    </div>

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

hi ,

you have a typo:

 <img scr="<?php echo $product ["img"]; ?>" alt="<?php echo $product["name"]; ?>">

should begin <img src

also, you need to have no space between $product and ["img"] it should be $product["img"]

Simon Tucker
Simon Tucker
9,113 Points

Cheers I have been looking at this for to long, I must need some sleep. Cheers.

1 Answer

haha - no problem, I know its addicting to go through all of these. Give me a correct answer if you will :}