show/hide based on URL parameter
I have a similar situation. I want to give people a discount if they have been referred from a Web Partner, and to hide/reveal specific areas of the page. It is also possible for people to apply for a discount directly on the registration page, but I want to know the difference. Same pages are common, some I want to show only to those referred by a URL, and some I only want to show to those booking directly on the page.
if (!session_id()) session_start();
if((((isset($_GET["StudioID"]))?$_GET["StudioID"]:"") != "")) {
$_SESSION["PromoCode"] = "".((isset($_GET["StudioID"]))?$_GET["StudioID"]:"") ."";
$studionumberweb = $_SESSION["PromoCode"];
$studionumber = $_SESSION["PromoCode"];
$_SESSION["StudioDiscountAmount"] = "NULL";
$studionumberdiscount = "yes";
$visitor = getenv("HTTP_REFERER");
}
?>
then a little further down the page I have ...
<div id="main-text">
<h1>My Purchase and Registration Form</h1>
<?php
// Show this if a valid web studio discount scheme has been instantiated
if (isset($studionumberweb) && (isset($studionumber))) { ?>
<h2 class="errormessage"><?php echo $studioname; ?> Studio Discount Scheme</h2>
<p>Thank you.</p>
<p>You are enrolling in our <strong>Discount Scheme</strong> through <?php echo $referrername; ?> of <?php echo $referrerocity; ?>, <?php echo $referrerstate; ?>.</p>
<p>This entitles you to a discount of <?php echo $studiodiscountamount; ?> per cent.</p>
<p>
<?php }
// End of show if a valid web studio discount scheme has been instantiated
?>
I then have a similar region which only shows if people have booked by entering a discount code directly on the page (and not got it via the GET of a URL)
if (isset($studionumberpage) && (isset($studionumber))) {
// blah blah blah
}
Doubtless one of the highly intelligent and experienced people here will give you a better answer. I do not know if this is the best approach, but it is working for me.
Bye.