PHP If Else error with IMG HTML tag :S?

Patrick Socha

New member
Hey all!

I'm making an image gallery for my site and i'm just editing an if else statement (where i get errors)

Here is part of the code:

<?php
if ( $img <= 0 ) {
echo "No Such image - Please press next.";
} else {
echo "<img src="images/<?php echo $img; ?>.jpg" width="400" height="500">";
}
?>

if i replace <img src="images/<?php echo $img; ?> with "image goes here" or whatever it works fine, but when i place the <img src.......> i get errors.

any ideas/solutions?

Many thanks,

Patrick
 
Back
Top