graham23s Posted February 10, 2008 Share Posted February 10, 2008 Hi Guys, i have concatinated this bit of code here: $display_box = ("<div id=\"right\">"); $display_box .= ("<div class=\"boxtop\"></div>"); $display_box .= ("<div class=\"box\">"); $display_box .= ("<p><img src=\"images/image.gif\" alt=\"Product Image\" title=\"Product Image\" class=\"image\" /><b>$product_name</b><br /><br />consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis.<br /></p>"); $display_box .= ("<div class=\"buttons\"><br /><a href=\"additemtocart.php?productid=$productid\"><img src=\"images/cart_navy.gif\" border=\"0\"></a><br /><br /><b>Quantity:</b>"); foreach($quantity as $value) { print("<select name=\"q\"><option value=\"$value\">$value</option>"); } $display_box .= ("</select></div>"); $display_box .= ("</div>"); but the foreach isn't being included inside it can anyone see what i have done? thanks guys Graham Link to comment https://forums.phpfreaks.com/topic/90362-a-foreach-in-a-variable-block/ Share on other sites More sharing options...
trq Posted February 10, 2008 Share Posted February 10, 2008 $display_box = "<div id=\"right\">"; $display_box .= "<div class=\"boxtop\"></div>"; $display_box .= "<div class=\"box\">"; $display_box .= "<p><img src=\"images/image.gif\" alt=\"Product Image\" title=\"Product Image\" class=\"image\" /><b>$product_name</b><br /><br />consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis.<br /></p>"; $display_box .= "<div class=\"buttons\"><br /><a href=\"additemtocart.php?productid=$productid\"><img src=\"images/cart_navy.gif\" border=\"0\"></a><br /><br /><b>Quantity:</b>"; foreach($quantity as $value) { $display_box .= "<select name=\"q\"><option value=\"$value\">$value</option>"; } $display_box .= "</select></div>"; $display_box .= "</div>"; Notice also you don't need (braces) around strings. Link to comment https://forums.phpfreaks.com/topic/90362-a-foreach-in-a-variable-block/#findComment-463277 Share on other sites More sharing options...
graham23s Posted February 10, 2008 Author Share Posted February 10, 2008 hey thanks T. Graham Link to comment https://forums.phpfreaks.com/topic/90362-a-foreach-in-a-variable-block/#findComment-463288 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.