I have the below code where i want to use a php variable (getting as user post) inside of a image url. if i direct use folder name everything is fine but if i use php variable image doesn't load. how can i fix it. please help me.
<a href='./admin/images/<?php $fid ?>/h66.jpg' class='cloud-zoom-gallery' title='Thumbnail 2'
rel="useZoom: 'zoom1', smallImage: './admin/images/<?php $fid ?>/h6.jpg'">
<img src="./admin/images/<?php $fid ?>/thmbh6.jpg" alt = "Thumbnail 2"/></a>
here $fid is a folder name and i get the $fid as user input.
You need to echo the variable:
<?php echo $variable; ?>
Hope this helps.
Or, as shorthand, you can do <?= $variable; ?>
This topic is now closed. New replies are no longer allowed.