Anthony Anthony - 3 months ago 9
PHP Question

php echo image single double quote not work

how to get this example echo image work,single and double?

data-mean="<?php
echo
'<div>' . $k["auto_ans"][$i] . '</div>' .
'<div><img src=' . $k["auto_image"][$i] . '></div>' .
'<div><img src=' . $k["auto_image2"][$i] . '></div>'; ?>"


i want it output:

data-mean="<div>AAAA</div><div><img src='aaa.jpg'></div><div><img src='bbb.jpg></div>"

Answer

You should put quotes around SRC prop like this :

data-mean="<?php 
echo 
'<div>' . $k["auto_ans"][$i] . '</div>' .
'<div><img src=\'' . $k["auto_image"][$i] . '\'></div>' . 
'<div><img src=\'' . $k["auto_image2"][$i] . '\'></div>'; ?>"