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 trialPrakhar Patwa
11,260 PointsI am not able to concatenate please help me out
<div class="row" id="features">
<div id="product-page">
<?php foreach($products as $product_id => $product){ ?>
<div class="col-lg-4 feature">
<div class="panel">
<div class="panel-heading">
<h3 class="panel-title">
<a href="shirt.php?id=".$product_id." class="btn btn-lg btn-info btn-block">
<span class="glyphicon glyphicon-th-large"></span> View Details
</a>
</h3>
</div>
<img src="<?php echo $product["img-sm"] ?>" alt="<?php echo $product["name"]?>" >
<div class="label label-info price"><span class="glyphicon glyphicon-tag"></span> <sup>$</sup><?php echo $product["price"]?></div>
<a href="" target="_blabk" class="btn btn-lg btn-primary btn-block bottom-btn"><span class="glyphicon glyphicon-shopping-cart"></span> Add to cart</a>
</div>
</div>
<?php } ?>
</div>
</div>
Prakhar Patwa
11,260 Pointsthanks Robert Zeno. Its working
1 Answer
Robert Zeno
4,660 PointsHi Prakhar,
I should have added an answer not a comment. Please mark this as correct.
The issue is that you are trying to concatenate HTML text with PHP text.
<a href="shirt.php?id=".$product_id." class="btn btn-lg btn-info btn-block">
Needs to just echo the string since you can not concatenate HTML text with PHP text
<a href="shirt.php?id=<?php echo $product_id; ?>" class="btn btn-lg btn-info btn-block">
Robert
Robert Zeno
4,660 PointsRobert Zeno
4,660 PointsHi Prakhar,
The issue is that you are trying to concatenate HTML text with PHP text.
<a href="shirt.php?id=".$product_id." class="btn btn-lg btn-info btn-block">
Needs to just echo the string since you can not concatenate HTML text with PHP text
<a href="shirt.php?id=<?php echo $product_id; ?>" class="btn btn-lg btn-info btn-block">
Robert