0

//I am trying to create a variable that contains some HTML so I can use it in other places using PHP but an error keeps coming out in vs code for the HTML. I tried another ide's installed so many extensions but nothing worked. Thanks for the help in advance

<?php

function component($productname, $productprice, $productimg, $productid){
    $element = "
      <div class="pro" onclick="window.location.href='sproduct.php' ">
            <img src="../images/p (6).png" alt="">
            <div class="des">
                <span>table</span>
                <h5>hello world</h5>
                <div class="stars">
                    <li><i class="fas fa-star "></i></li>
                    <li><i class="fas fa-star "></i></li>
                    <li><i class="fas fa-star "></i></li>
                    <li><i class="fas fa-star "></i></li>
                    <li><i class="fas fa-star "></i></li>
                </div>
                <h4>123$</h4>

            </div>
            <a href="#"><i class="fal fa-shopping-cart cart"></i></a>
    </div>
    ";
}
Bakr Mrad
  • 1
  • 1
  • 1
    Your double quotes around your classes and onclick are messing up your double-quoted string. – aynber May 10 '22 at 16:10

0 Answers0