Hi all,

So I would like a else statement that would go like this:

<?php
if ($image=="none")
echo "no image";
else
<img src="../images/<?php echo $image; ?>"> ;
?>

Obviously this does not work. Any suggestions on how to get it to work?

So if $image's value is 'none' then it echo's 'no image'
If its not then it echo's what ever the value is as an image name.
Hence displaying that image.

Hope my explanation was ok.

Only learning this stuff at the moment. Is this the right way to go about this?
Any advise welcomed.

Thanks
Gavin

<?php
  if ($image == "none")
    echo "no image";
  else
    echo '<img src="../images/' . $image . '"/>';
?>

Legend
Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.