Too Big World

The Blog of Gordon Milcham

Showing conditional divs using php and if/else statements

/

If you want to show some divs instead of others on a website IF some condition is met you can use the following piece of code:

php if ($artist_id == “1980”) { ?>

Some data

php } else { ?>

Some other data

<? } ?>

The data and the whole layout can be different, as in this case, but it doesn’t have to. Customize as required.

Thanks to Mellamokb @ StakOverflow.


Discover more from Too Big World

Subscribe to get the latest posts sent to your email.

Categories:

Tags:


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.