How do you do this in PHP? (If X, include Y, else don't include anything at all)

by Thomas
3 replies
Hello Warriors:

I know how to say if X, then include y.html, else include z.html.

However, other than making z.html empty, how do you instead say: if X, then include (piece of html), else don't include any extra html at all?

I've no doubt it's actually very simple, but it's making my brain hurt at this stage! Can someone please put me out of my ignorance?

Thanks,
Tommy.
#include #php
  • Profile picture of the author Patrick
    Dont use else...only if..thats all..It is not necessary for every IF statement to have an else...
    {{ DiscussionBoard.errors[3393908].message }}
  • Profile picture of the author Thomas
    Originally Posted by schwarzes View Post

    Dont use else...only if..thats all..It is not necessary for every IF statement to have an else...
    Ah... even more simple that I thought then!

    Like so?

    if (isset($_GET["X"])) {include ("stuff.html");}
    {{ DiscussionBoard.errors[3393992].message }}
  • Profile picture of the author Patrick
    Yes ..that should do it
    {{ DiscussionBoard.errors[3393998].message }}

Trending Topics