Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8173979

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T22:20:04+00:00 2026-06-06T22:20:04+00:00

I have a PHP statement on a sidebar, the sidebar is included on all

  • 0

I have a PHP statement on a sidebar, the sidebar is included on all pages.
In the sidebar I want hide content on the results page, so I’m using this:

<?php
if ($page!='results')
{?>
<h1>THE MAIN SIDEBAR CONTENT</h1>
<div>
SOME CONTENT          
</div>
<?php }  ?>

The problem is that it looks like its not recognising the page as having

$page='results';

at the top of it. Maybe because the code is in a included page but I thought it would just get read as one page?

If I add

$page='results';

to the start of the above script, it works (just to verify I have written the code correctly.

I have also checked that results.php has

$page='results';

right at the very top of it.

Can I not use this code on an include or am I missing something?

As per navnav’s request, here is the code for the include and the actual page. NOTE I am not actually using ‘$results’ I’d just used that as an example for my post. In the real code below, you’ll see I am using ‘$getvaluation’

Code for sidebar….

<div class="right_part right_home">
      <h1 style="padding-left: 25px">Property <span>Search</span></h1>

      <script type="text/javascript">
          $('#couHertfordshire').click(function(){
            var v = $(this).val();
            $('#couHertfordshire_hide').val(v);
          });
           $('#couLondonNorth').click(function(){
            var v = $(this).val();
            $('#couLondonNorth_hide').val(v);
          });
           $('#couLondonNorthWest').click(function(){
            var v = $(this).val();
            $('#couLondonNorthWest_hide').val(v);
          });
      </script>

      <?php
            $page = $_SERVER['REQUEST_URI'];
            $page = explode('/', $page);
        if (isset($_POST['bed']) && $_POST['bed'] != '' && $page[2] == 'test.php'){
            $url = 'http://www.vebra.com/home/quick/PFrefine.asp';
            $target = 'target="hello"';
            $js_submit = true;                  

            $bed = $_POST['bed'];
            $min = $_POST['lop'];
            $max = $_POST['hip'];
            $area1 = $_POST['cou1'];
            $area2 = $_POST['cou2'];
            $area3 = $_POST['cou3'];
            // Hidden Fields
            $hidden1 = $_POST['slo'];
            $hidden2 = $_POST['fid'];
            $hidden3 = $_POST['bid'];
            $hidden4 = $_POST['dbt'];
            $hidden5 = $_POST['nre'];
            $hidden6 = $_POST['thu'];
            $hidden7 = $_POST['vto'];
            $hidden8 = $_POST['ord'];
            $hidden9 = $_POST['nba'];

        } else {

            $url = 'test.php';
            $target = '';
            $js_submit = false;
        }           

      ?>

      <form method="post" action="<?php echo $url; ?>" name="searchform" id="searchform" <?php echo $target; ?> >
        <dl id="property_search">
          <dt class="bord">Bedrooms</dt>
          <dd><select name="bed" class="type1 Selectrooms">
                  <option <?php if($bed == '0'){ echo 'selected="selected"';} ?> value="0">0</option>
                  <option <?php if($bed == '1'){ echo 'selected="selected"';} ?> value="1">1</option>
                  <option <?php if($bed == '2'){ echo 'selected="selected"';} ?> value="2">2</option>
                  <option <?php if($bed == '3'){ echo 'selected="selected"';} ?> value="3">3</option>
                  <option <?php if($bed == '4'){ echo 'selected="selected"';} ?> value="4">4</option>
                  <option <?php if($bed == '5'){ echo 'selected="selected"';} ?> value="5">5+</option>
              </select>
          </dd>

          <dt class="bord">Minimum Price</dt>
          <dd><select class="type2 SelectPrices" name="lop">
                <option <?php if ($min == '0'){ echo 'selected="selected"';} ?> value="0">&#163;0</option>
                <option <?php if ($min == '25000'){ echo 'selected="selected"';} ?> value="25000">&#163;25,000</option>
                <option <?php if ($min == '50000'){ echo 'selected="selected"';} ?> value="50000">&#163;50,000</option>
                <option <?php if ($min == '75000'){ echo 'selected="selected"';} ?> value="75000">&#163;75,000</option>
                <option <?php if ($min == '100000'){ echo 'selected="selected"';} ?> value="100000">&#163;100,000</option>
                <option <?php if ($min == '125000'){ echo 'selected="selected"';} ?> value="125000">&#163;125,000</option>
                <option <?php if ($min == '150000'){ echo 'selected="selected"';} ?> value="150000">&#163;150,000</option>
                <option <?php if ($min == '175000'){ echo 'selected="selected"';} ?> value="175000">&#163;175,000</option>
                <option <?php if ($min == '200000'){ echo 'selected="selected"';} ?> value="200000">&#163;200,000</option>
                <option <?php if ($min == '225000'){ echo 'selected="selected"';} ?> value="225000">&#163;225,000</option>
                <option <?php if ($min == '250000'){ echo 'selected="selected"';} ?> value="250000">&#163;250,000</option>
                <option <?php if ($min == '275000'){ echo 'selected="selected"';} ?> value="275000">&#163;275,000</option>
                <option <?php if ($min == '300000'){ echo 'selected="selected"';} ?> value="300000">&#163;300,000</option>
                <option <?php if ($min == '325000'){ echo 'selected="selected"';} ?> value="325000">&#163;325,000</option>
                <option <?php if ($min == '350000'){ echo 'selected="selected"';} ?> value="350000">&#163;350,000</option>
                <option <?php if ($min == '375000'){ echo 'selected="selected"';} ?> value="375000">&#163;375,000</option>
                <option <?php if ($min == '400000'){ echo 'selected="selected"';} ?> value="400000">&#163;400,000</option>
                <option <?php if ($min == '500000'){ echo 'selected="selected"';} ?> value="500000">&#163;500,000</option>
                <option <?php if ($min == '600000'){ echo 'selected="selected"';} ?> value="600000">&#163;600,000</option>
                <option <?php if ($min == '700000'){ echo 'selected="selected"';} ?> value="700000">&#163;700,000</option>
                <option <?php if ($min == '800000'){ echo 'selected="selected"';} ?> value="800000">&#163;800,000</option>
                <option <?php if ($min == '900000'){ echo 'selected="selected"';} ?> value="900000">&#163;900,000</option>
                <option <?php if ($min == '1000000'){ echo 'selected="selected"';} ?> value="1000000">&#163;1,000,000</option>
                <option <?php if ($min == '2000000'){ echo 'selected="selected"';} ?> value="2000000">&#163;2,000,000</option>
                <option <?php if ($min == '3000000'){ echo 'selected="selected"';} ?> value="3000000">&#163;3,000,000</option>
                <option <?php if ($min == '4000000'){ echo 'selected="selected"';} ?> value="4000000">&#163;4,000,000</option>
                <option <?php if ($min == '5000000'){ echo 'selected="selected"';} ?> value="5000000">&#163;5,000,000</option>
                <option <?php if ($min == '6000000'){ echo 'selected="selected"';} ?> value="6000000">&#163;6,000,000</option>
              </select>
          </dd>

          <dt class="bord">Maximum Price</dt>
          <dd><select name="hip" class="type3 SelectPrices">
                <option <?php if ($max == '25000'){ echo 'selected="selected"';} ?> value="25000"> &#163;25,000</option>
                <option <?php if ($max == '50000'){ echo 'selected="selected"';} ?> value="50000">&#163;50,000</option>
                <option <?php if ($max == '75000'){ echo 'selected="selected"';} ?> value="75000">&#163;75,000</option>
                <option <?php if ($max == '100000'){ echo 'selected="selected"';} ?> value="100000">&#163;100,000</option>
                <option <?php if ($max == '125000'){ echo 'selected="selected"';} ?> value="125000">&#163;125,000</option>
                <option <?php if ($max == '150000'){ echo 'selected="selected"';} ?> value="150000">&#163;150,000</option>
                <option <?php if ($max == '175000'){ echo 'selected="selected"';} ?> value="175000">&#163;175,000</option>
                <option <?php if ($max == '200000'){ echo 'selected="selected"';} ?> value="200000">&#163;200,000</option>
                <option <?php if ($max == '225000'){ echo 'selected="selected"';} ?> value="225000">&#163;225,000</option>
                <option <?php if ($max == '250000'){ echo 'selected="selected"';} ?> value="250000">&#163;250,000</option>
                <option <?php if ($max == '275000'){ echo 'selected="selected"';} ?> value="275000">&#163;275,000</option>
                <option <?php if ($max == '300000'){ echo 'selected="selected"';} ?> value="300000">&#163;300,000</option>
                <option <?php if ($max == '325000'){ echo 'selected="selected"';} ?> value="325000">&#163;325,000</option>
                <option <?php if ($max == '350000'){ echo 'selected="selected"';} ?> value="350000">&#163;350,000</option>
                <option <?php if ($max == '375000'){ echo 'selected="selected"';} ?> value="375000">&#163;375,000</option>
                <option <?php if ($max == '400000'){ echo 'selected="selected"';} ?> value="400000">&#163;400,000</option>
                <option <?php if ($max == '500000'){ echo 'selected="selected"';} ?> value="500000">&#163;500,000</option>
                <option <?php if ($max == '600000'){ echo 'selected="selected"';} ?> value="600000">&#163;600,000</option>
                <option <?php if ($max == '700000'){ echo 'selected="selected"';} ?> value="700000">&#163;700,000</option>
                <option <?php if ($max == '800000'){ echo 'selected="selected"';} ?> value="800000">&#163;800,000</option>
                <option <?php if ($max == '900000'){ echo 'selected="selected"';} ?> value="900000">&#163;900,000</option>
                <option <?php if ($max == '1000000'){ echo 'selected="selected"';} ?> value="1000000">&#163;1,000,000</option>
                <option <?php if ($max == '2000000'){ echo 'selected="selected"';} ?> value="2000000">&#163;2,000,000</option>
                <option <?php if ($max == '3000000'){ echo 'selected="selected"';} ?> value="3000000">&#163;3,000,000</option>
                <option <?php if ($max == '4000000'){ echo 'selected="selected"';} ?> value="4000000">&#163;4,000,000</option>
                <option <?php if ($max == '5000000'){ echo 'selected="selected"';} ?> value="5000000">&#163;5,000,000</option>
                <option <?php if ($max == '6000000'){ echo 'selected="selected"';} ?> value="6000000">&#163;6,000,000+</option>
              </select>
          </dd>
          <dt>Regions</dt><dd><img src="images/spacer.gif" alt="" /></dd>

          <dt><input <?php if( $area1 == '43' ){ echo 'checked="checked"';} ?> type="checkbox" name="cou1" id="couHertfordshire" value="43" /></dt><dd>Hertfordshire</dd>
          <dt><input <?php if( $area2 == '126' ){ echo 'checked="checked"';} ?> type="checkbox" name="cou2" id="couLondonNorth" value="126" /></dt><dd>London, North</dd>
          <dt><input <?php if( $area3 == '127' ){ echo 'checked="checked"';} ?> type="checkbox" name="cou3" id="couLondonNorthWest" value="127" /></dt><dd>London, North West</dd>

            <input type="hidden" name="cou" id="couHertfordshire_hide" value="<?php if ( $area1 == '43' ) { echo '43';} ?>" />
            <input type="hidden" name="cou" id="couLondonNorth_hide" value="<?php if ( $area2 == '126' ) { echo '126';} ?>" />
            <input type="hidden" name="cou" id="couLondonNorthWest_hide" value="<?php if ( $area3 == '127' ) { echo '127';} ?>" />

            <input type="hidden" name="slo" value="undefined" />
            <input type="hidden" name="fid" value="894" />
            <input type="hidden" name="bid" value="0" />
            <input type="hidden" name="dbt" value="1" />
            <input type="hidden" name="nre" value="undefined" />
            <input type="hidden" name="thu" value="undefined" />
            <input type="hidden" name="vto" value="undefined" />
            <input type="hidden" name="ord" value="undefined"/>
            <input type="hidden" name="nba" value="undefined" />

          <dt><input type="submit" class="search_now" value="Find Property" /></dt><dd><img src="images/spacer.gif" alt="" /></dd>
        </dl>
      </form>

      <?php if($js_submit){ ?>

        <script type="text/javascript">
            $(document).ready(function() {
                document.forms["searchform"].submit();
            });
        </script>

        <?php } ?>

      <div><a href="register.php" class="register_with_us"><img src="images/spacer.gif" alt="" /></a></div>
      <div><a href="contact.php" class="our_branches"><img src="images/spacer.gif" alt="" /></a></div>
      <div><a href="valuation.php" class="free_valuation"><img src="images/spacer.gif" alt="" /></a></div>

        <?php
        if ($page!='getvaluation')
       { ?> 
       <h1 class='bot_line'>Featured <span>Property</span></h1>
      <div>
      <?php perch_content('Featured Property Image');?>           
      </div>
      <h3><?php perch_content('Featured Property Title'); ?></h3>
     <p>
     <?php perch_content('Featured Property Description'); ?>

     </p>      
     <?php }  ?>
    </div>
     <div>

  </div>

Code for Valuation Page

<?php 
$page='getvaluation'; 
include('perch/runtime.php'); ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1    /DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang='en' dir='ltr'>
<head>
<title>Squires Estates - Independent Estate Agent, London</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<link href="css/screen.css" rel="stylesheet" type="text/css" />

<!--[if IE]>
<![if lt IE 7]>
  <script type="text/javascript" src="js/DD_belatedPNG.js"></script>
  <script type="text/javascript" src="js/ie6.js"></script>
<![endif]>
<![endif]-->

<link rel="stylesheet" href="slider/themes/default/default.css" type="text/css" media="screen" />
<link rel="stylesheet" href="slider/nivo-slider.css" type="text/css" media="screen" />

<script type="text/javascript" src="slider/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="slider/jquery.nivo.slider.js"></script>
<script type="text/javascript">
$(window).load(function() {
    $('#slider').nivoSlider({
        controlNav: false,
        effect: 'fade', // Specify sets like: 'fold,fade,sliceDown'
    });
});
</script>


<script type="text/javascript">
 function blurInspection(el, text) {if (el.value == '') {el.value=text;}}
 function focusInspection(el, text) {if (el.value == text) {el.value='';}}
</script>

</head>

<body>


<div id="wrapper">

<?php include("header.php"); ?>

  <div id="content">
    <div class="left_part left_home">
      <h1 class="bot_line">Please use the form below to arrange a free valuation</span></h1>
      <?php 
      // Text Section
      //perch_content('form');?>
      <?php perch_content('Form Text');?>
    </div>
    <?php 
    include('sidebar.php');
    include('footer.php');
    ?>
  • 0 0 Answers
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T22:20:05+00:00Added an answer on June 6, 2026 at 10:20 pm

    Make sure you’re including the file that assigns result to $page before you do the comparing.

    So,

    This is bad:

    <?php
    if ($page!='results')
    {?>
    <h1>THE MAIN SIDEBAR CONTENT</h1>
    <div>
    SOME CONTENT          
    </div>
    <?php }  
    include("the-file-here-that-defines-$page");//The include line is AFTER the comparing here...which means the $page value will not be changed until after the comparing...
    ?>
    

    This is good:

    <?php
    include("the-file-here-that-defines-$page");//the include line is BEFORE the comparing, so $page will change before, and it should all work well..
    if ($page!='results')
    {?>
    <h1>THE MAIN SIDEBAR CONTENT</h1>
    <div>
    SOME CONTENT          
    </div>
    <?php }  
    
    ?>
    

    EDIT:

    I’ve taken a look at your edit, and my original suggestion is causing the issue. In your sidebar.php you have $page = explode('/', $page); which is executed after you do $page='getvaluation'; but, you’re also doing your comparing in sidebar.php which you also re-define $page in.

    A quick fix for this would be to simply use another variable to represent ‘getvaluation’:

    So, in your sidebar.php:

    if($getValuation===true){$page='getvaluation';}//check if $getValuation is true (which will will be defined in your valuation page)
            if ($page!='getvaluation')
           { ?> 
           <h1 class='bot_line'>Featured <span>Property</span></h1>
          <div>
          <?php perch_content('Featured Property Image');?>           
          </div>
          <h3><?php perch_content('Featured Property Title'); ?></h3>
         <p>
         <?php perch_content('Featured Property Description'); ?>
    
         </p>      
         <?php }  ?>
        </div>
         <div>
    

    And now, in your valuation page:

    Instead of:

    <?php 
    $page='getvaluation'; 
    

    do this:

    <?php 
    $getValuation=true; 
    

    and on other pages (pages where you would like the side bar to show), simply do not define $getValuation or assign it to false:

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a php file which has a require_once Statement (?) this file is
i have one php page with paging option i use follwoing sql statement to
I have the following PHP PDO statement: $STH = $this->_db->prepare(INSERT INTO UserDetails (FirstName, LastName,
I have this PHP case statement switch ($parts[count($parts) - 1]) { case 'restaurant_pos': include($_SERVER['DOCUMENT_ROOT']
I have this php statement in my login script... else if ($_POST['email'] === $details['email']
I have a PHP validate statement for a file upload on a HTML form.
i have a statement in my php: <? if(isset($_GET['mod']) && ($_GET['mod'] == category ||
I have a SQL update statement I am running from inside a PHP program.
I have a series of PHP statements that I only want to run if
I have PHP script works without problems, like this : while($row4 = mysql_fetch_array($result4)) {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.