close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

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 Eric Mittman | 2185 views | 3 replies |

yogastudents362523

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

Sign in to reply to this post

Eric Mittman

I moved this thread to a new one so that it does not get too confusing for the other individual that seems to have a simpler problem. Here is a link to the original thread for reference:

showthread.php?p=50755#post50755

So it seems that you have show regions that you are hiding and showing based on URL parameters. Are you not getting the correct result with the code that you posted? What is the current result that you are getting and how does it differ from the desired result? With this info I think we will better be able to give some advice on your situation.

Sign in to reply to this post

yogastudents362523

I was not having a problem.
Nobody seemed to be helping the guy out, so I thought I would try.
Maybe it was the weekend or something.
Apologies if I confused him. I had simply had a similar problem and had been able to resolve it ... so ... ... ...

probably best keep my mouth shut in future, ay??!!!!!!

You stay well now.
Thanks.
Bye

Sign in to reply to this post

Eric Mittman

My apologies, I'm so use to answering questions that people have and did not notice that you were just trying to help. Please feel free to post on any of your experiences or related issues to any existing thread, I will add a link to this new thread back where you had posted it originally in case any one else finds it and could benefit from your experience.

Sign in to reply to this post

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

Content

rating

Layout

rating

Ease of use

rating

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