close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

show/hide based on URL parameter

Thread began 3/23/2010 4:00 am by yogastudents362523 | Last modified 3/24/2010 4:28 pm by yogastudents362523 | 3170 views | 3 replies


show/hide based on URL parameter

Originally Said By: The Laptop Doctor
  Hi, I would like to show an area on my page if a parameter exists in the address bar, and hide another area.  

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>
// 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>
<?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.


Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question





Ease of use


security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...