Show header on search results if value is true

8 posts by 2 authors in: Forums > CMS Builder
Last Post: January 27, 2016   (RSS)

By Damon - January 21, 2016

Hi,

Here is some code that will grab the variable, compare it and then output content if it matches: 

<?php if(@$_GET["quick_ship"] == "quick_ship") : ?>
   <p><strong>Display Quick Ship content</strong></p>
<?php endif; ?>

Let me know if this works for you.

Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By dccreatives - January 27, 2016

I got this to work like this

<?php if(@$_GET["quickship"]) : ?>

<p> text area here</p>

<?php endif; ?>

Now they only want this to show when you click on this page: http://www.axislighting.com/CMS/search_products-qs.php and hit the radio button QuickShip

They want me to add to the menu dropdowns these results which are filtered by a field called mounting. see this page the dropdowns (http://www.axislighting.com/CMS/header_footer.php - under the quickship, there are options 'all products' THIS SHOULD SHOW HEADER, then there is recessed, pendant, surface, THESE SHOULD NOT SHOW HEADER)

So on these pages:

http://www.axislighting.com/CMS/search_products-qs.php?quickship=quickship&mounting=recessed

http://www.axislighting.com/CMS/search_products-qs.php?quickship=quickship&mounting=pendant

http://www.axislighting.com/CMS/search_products-qs.php?quickship=quickship&mounting=surface

They dont want the header. How do I write

<?php if(@$_GET["quick_ship"] & ['mounting' ]?> mounting not selected...then show the header.

By Damon - January 27, 2016

Hi,

Here is the code you are after:

<?php if((@$_REQUEST["quick_ship"]) && (@!$_GET["mounting"])); ?>
  ....show the header
<?php endif; ?>

If there IS a quick_ship value and the ISN't a mounting value, the if statement will run.

Let me know if this works for you.

Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By dccreatives - January 27, 2016

I am getting this error:

Parse error: syntax error, unexpected 'endif' (T_ENDIF) in /home/axislig1/public_html/CMS/search_products_results4-qs.php on line 49

See how I added it.

By Damon - January 27, 2016

Use this code:

<?php if((@$_REQUEST["quick_ship"]) && (@!$_REQUEST["mounting"])) : ?>

I changed semi-colon to colon.

Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By Damon - January 27, 2016

Hi again,

Ok, I updated the code run the IF statement (show header bar) in either of these queries:
?quick_ship=quickship
?quick_ship=quickship&mounting=

<?php if((@$_REQUEST["quick_ship"]) && (@$_REQUEST["mounting"] == "")): ?>

Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/