jared
jared

Reputation: 11

PHP array display image

How can I display a picture using php array so far using html didn't work its just displaying the string itself. Here is my code for it :

      $output = array(  
            'order_table'       =>  $order_table,
            'cart_item'         =>  '<img src="samples/cart.png">' .count($_SESSION["shopping_cart"])
  );  

Upvotes: 0

Views: 79

Answers (1)

B. Desai
B. Desai

Reputation: 16436

You have to add quotation around imgtag and then display it using echo in php

 $output = array(  
            'order_table'       =>  $order_table,
            'cart_item'         =>  '<img src="samples/cart.png">' .count($_SESSION["shopping_cart"]),
  );  

echo $output['cart_item']; //This will display the image

Upvotes: 2

Related Questions