3 posts by 2 authors in: Forums > CMS Builder
Last Post: February 2, 2018   (RSS)

Hi All.

I have a home page with a div, then a list of items.  I'm using the standard search form to filter those items. ie

<form class="form-inline my-2 my-lg-0 mr-auto" method="POST" action="<?php echo PREFIX_URL ?>/index.php">
<input class="form-control" type="search" name="name,description,tags_keyword" placeholder="Search" value="">
<button class="btn btn-outline-info my-2 my-sm-0" type="submit">Search</button>

Is there any way to hide the div if that page is being viewed as the results of a search?


<?php if (@$SEARCH): ?>
<div>This is the div that I want to hide</div>
<?php endif ?>



Tim Forrest
Toledoh Enterprises

Hi Tim,

The answer is yes, you can let the search form submit a checker to determine if the form is submitted. Change your submit button to this:

<button class="btn btn-outline-info my-2 my-sm-0" type="submit" name="searchFormSubmitted" value="1">Search</button>

And your if statement will be:

<?php if(!@$_REQUEST['searchFormSubmitted']): ?>

Let me know if you have any questions!

Leo - PHP Programmer (in training)