Show header on search results if value is true

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

I have a customized search page:

http://www.axislighting.com/CMS/search_products-test.php

If quickship is selected above the results I would like to show some content. How can I write an if then statement that if 'quick_ship=quick_ship' then show this content?

This page shows all the results of quickship. On this page, I want to show some content above the search results. I want it to show only if the quick ship are selected.

http://www.axislighting.com/CMS/search_products-test.php?quick_ship=quick_ship

I am attaching both pages. The first is the search products which shows the options to select to refine your search. The results page is where the results refresh as you select.

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

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/