newcomer newcomer - 2 months ago 5x
PHP Question

How to output this HTML code in PHP?

<li class="moveUnit">
<a href="javascript:void(0)" title="" class="currentItem">
<img src="$picture[1]" alt="" ref1="$picture[1]" ref2="$picture[1]" onmouseover="Biz.Product.Product.ChangePic(this);" class="Picture40"/>

by trying to put this line of code in php file, I found this line has reserved char that will not be allowed in php. Please help, I have tried
. Still, I don't know why it is not working.


If this is inside php tags (<?php ?>) it will need to be output using echo(); like so:

echo '<li class="moveUnit"><a href="javascript:void(0)" title="" class="currentItem"><img src="' . $picture[1] . '" alt="" ref1="' . $picture[1] . '" ref2="' . $picture[1] . '" onmouseover="Biz.Product.Product.ChangePic(this);" class="Picture40"/></a></li>' ;

OR if it's not between, you can echo just those variables between HTML:

<li class="moveUnit"><a href="javascript:void(0)" title="" class="currentItem"><img src="<?php echo $picture[1]; ?>" alt="" ref1="<?php echo $picture[1]; ?>" ref2="<?php echo $picture[1]; ?>" onmouseover="Biz.Product.Product.ChangePic(this);" class="Picture40"/></a></li>