Session echo
Hi i want to echo session but it gives error...code is
session_start();
if(isset($_GET['P_Price']))
{
$_SESSION['Price'] = $_SESSION['Price']+ $_GET['P_Price'];
$_SESSION['Items']++;
" <div class=\"shopping_cart\">
<div class=\"cart_title\">Shopping cart</div>
<div class=\"cart_details\">Items
echo $_SESSION['Items']; /// this line has error
<span class=\"border_cart\"></span>
Total: <span class=\"price\">echo $_SESSION['Price']; </span> ////this line has error also
</div>
<div class=\"cart_icon\"\><a href=\"#\" title=\"header=[Checkout] body=[ ] fade=[on]\"><img src=\"images/shoppingcart.png\" alt=\"\" title=\"\" width=\"48\" height=\"48\" border=\"0\" /></a></div>
</div>";
Farhad.idrees
Junior Poster in Training
63 posts since Dec 2010
Reputation Points: 11
Solved Threads: 0
No dear its not working...just tell me how can u echo session in html code?
Farhad.idrees
Junior Poster in Training
63 posts since Dec 2010
Reputation Points: 11
Solved Threads: 0
"
Shopping cart
Items
echo $_SESSION['Items'];
/// this line has error
Total: echo $_SESSION['Price']; ////this line has error also
";
Wrong syntax. Try with below:
echo "<div class=\"shopping_cart\">\n
<div class=\"cart_title\">Shopping cart</div>\n
<div class=\"cart_details\">Items " . $_SESSION['Items'] . "<span class=\"border_cart\"></span>
Total: <span class=\"price\">" . $_SESSION['Price'] . "</span>\n
</div>\n
<div class=\"cart_icon\"\><a href=\"#\" title=\"header=[Checkout] body=[ ] fade=[on]\"><img src=\"images/shoppingcart.png\" alt=\"\" title=\"\" width=\"48\" height=\"48\" border=\"0\" /></a></div>\n
</div>\n";
'\n' for line feed. It will force to appear HTML tag from the new line in the source code.
Zero13
Practically a Master Poster
624 posts since Jan 2009
Reputation Points: 120
Solved Threads: 139