Skip to content

Instantly share code, notes, and snippets.

@marcamos
Last active December 10, 2015 22:38
Show Gist options
  • Save marcamos/4503420 to your computer and use it in GitHub Desktop.
Save marcamos/4503420 to your computer and use it in GitHub Desktop.
Use PHP to show (or not show) something based on the existence (or lack of) a particular parameter.
<?php if (isset ($_GET["preview"])) { ?>
"Preview" exsists as a URL parameter
<? } ?>
<?php if (!isset ($_GET["preview"])) { ?>
"Preview" does not exsist as a URL parameter
<? } ?>
<?php if ($_GET["preview"] == "true") { ?>
"Preview" has a value of "true"
<? } ?>
<?php if ($_GET["preview"] !== "true") { ?>
"Preview" does not have a value of "true"
<? } ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment