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 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 :}