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 region if url parameter exists

Thread began 3/21/2010 3:09 pm by The Laptop Doctor | Last modified 3/24/2010 4:30 pm by Eric Mittman | 4816 views | 4 replies |

The Laptop Doctor

Show region if url parameter exists

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 an enquiry form on the index.php page, and when the form is submitted, it submits to the same page (index.php) and universal email sends the contents of the form to an email address.

I dont want to create a thankyou.php page, but instead show a thankyou region and hide the form once submitted.

My url would show something like:

?ref=thankyou

Then the div containing the form elements would be hidden, and the div containing the thank you message would be displayed.

Is this possible?

Thanks

Lee

Sign in to reply to this post

Jimmy Wu

Yes, you would want to add a couple of php blocks around the code you want to have conditionally show:
<?php if (isset($_REQUEST["ref"])) { ?>
<p>your code</p>
<?php } ?>

Then you would want to use the isset function to check if the variable is set or not to determine if you want to show the code or not.

Sign in to reply to this post

The Laptop Doctor

Thanks Jimmy, so... if I have the index page containing the form and universal email goes to the same page (index.php?ref=thankyou) how do I hide the form and show the thank you confirmation?

For instance:

Here is the show if section of the page: (Upon successful submission of the form)

<?php if (isset($_REQUEST["ref"])) { ?>
<h2>Thank You!</h2>
<p>Thank you for submitting your Mortgage Enquiry search.</p>
<p>We will be in contact with you shortly.</p>
<?php } ?>

How do I then hide the form below it?

Thanks

Lee

Sign in to reply to this post

Eric Mittman

You can show an alternate message or area of the page with your if statement by adding in an else like this:

php:
<?php if (isset($_REQUEST["ref"])) { ?>

<h2>Thank You!</h2>
<p>Thank you for submitting your Mortgage Enquiry search.</p>
<p>We will be in contact with you shortly.</p>
<?php } else { ?>
the form goes here
<?php ?>



This will show either the thank you message or the form, but not both.

Sign in to reply to this post

Eric Mittman

Here is also a link to a thread where a user had a similar issue that and how they solved it:

showthread.php?p=51141#post51141

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