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

PHP: shirt.php looks weird

Hello people,

When I was working on my php file integrating with paypal, somehow the format for shirt.php got weird like the screenshot that I attached, PHP seems working properly, so there must be problem with html, but I don't know where causing problem...

Here is my code: '''php <?php

$products = array(); $products[101]=array( "name" => "Logo Shirt, Red", "price" => 18, "img" => "img/shirts/shirt101.jpg"

); 

$products[102] = array( "name" => "Mike the Frog Shirt, Black", "img" => "img/shirts/shirt-102.jpg", "price" => 20 ); $products[103] = array( "name" => "Mike the Frog Shirt, Blue", "img" => "img/shirts/shirt-103.jpg",
"price" => 20 ); $products[104] = array( "name" => "Logo Shirt, Green", "img" => "img/shirts/shirt-104.jpg",
"price" => 18); $products[105] = array( "name" => "Mike the Frog Shirt, Yellow", "img" => "img/shirts/shirt-105.jpg",
"price" => 25 ); $products[106] = array( "name" => "Logo Shirt, Gray", "img" => "img/shirts/shirt-106.jpg",
"price" => 20 ); $products[107] = array( "name" => "Logo Shirt, Turquoise", "img" => "img/shirts/shirt-107.jpg",
"price" => 20 ); $products[108] = array( "name" => "Logo Shirt, Orange", "img" => "img/shirts/shirt-108.jpg",
"price" => 25, ); //add a variable to an array

?> <?php $pageTItle="Mike's Full Catalogue of Shirts"; $section = "shirts"; include('inc/header.php'); ?>

<div class="section page">

    <div class="wrapper">
        <h1>Mike&rquo;s Full Catalogue of Shirts </h1>

        <ul class="products">
            <?php foreach($products as $product) {
                    echo "<li>";
                    echo '<a href="#">';
                    echo '<img src="' .$product["img"] . '" alt="' .$product["name"] . '">';
                    echo"<p>View Detailes</p>";
                    echo"</a>";
                    echo "</li>"; 
                }
                ?>
        </ul>
    </div>


</div>

'''

Can anyone help, please??

/Users/aoiasano/Desktop/Screen Shot 2014-05-19 at 5.33.26 PM.png

5 Answers

Hi Aoi,

I compared with my local copy of the project and it looks like you're missing the "shirts" class in your outermost div.

<div class="section shirts page">

Hey Aol,

It looks like your screenshot didn't attach properly and some of your code formatting is off. If you update it, I'll try and have a look for you.

Does anyone know how to upload screenshots and mark snippet properly? I tried, but it does not work somehow....

Hi Aol,

Someone else can jump in as I am new to these forums, but judging on the documentation in the Markdown Cheatsheet, it looks like the image needs to be uploaded to your own server and then linked to on the boards. If there's another way, someone might know but this is how it appears on first look.

Jason, It worked perfectly!!! Thank you so much for the help!!!! :)