How to set this if isset function

Posted by Danny Florian on Stack Overflow See other posts from Stack Overflow or by Danny Florian
Published on 2012-06-26T03:06:06Z Indexed on 2012/06/26 3:15 UTC
Read the original article Hit count: 172

Filed under:
|

I have the following code that sets a background if user has uploaded to database. If user has NOT uploaded an image then the result is a blank img src=''

I need to set this as an if isset function so I can plug in an alternate image if user has not uploaded anything.

Here is the current code:

<div id="background"><?php echo isset($background_image) && file_exists(ROOT.$background_image)?"<img src='$background_image' alt='' />":'';?></div>

© Stack Overflow or respective owner

Related posts about php

Related posts about html