title: Display output result in another page in PHP
body: <p>I have a Tour Search application where user can search for available tours based on three different parameters- Region, Country and Duration. Currently the code which I am using is showing the Output Result in the same page. I want the output result to show in a different page.</p>
  
  <p><img src="https://s29.postimg.org/5nzgu97lj/db_new.jpg" alt="Database Structure"></p>
  
  <p>Below is my PHP Code:</p>
  
  <pre><code>&lt;?php
        mysql_connect("localhost", "root", "");
      mysql_select_db("byp");
  
      if(isset($_POST['submit'])){
          $region=$_POST['region'];
          $country=$_POST['country'];
          $duration=$_POST['duration'];
  
          //define the index for the All option
          $optionAllValue = 0; //add here the option index value used for the 'All' option
          //define the where clause for the query
          //in order to avoid many conditions verifications, we start it as 1=1
          $whereClause = "1=1";
  
          //now we check if the option selected for each field is not the value defined for the option 'All'
          //this is just an example, and the best would be to create a function to avoid the replication of code 
          if($region != $optionAllValue)
          {
              $whereClause = $whereClause." and region='$region'";
          }
          if($country != $optionAllValue)
          {
              $whereClause = $whereClause." and country='$country'";
          }
          if($duration != $optionAllValue)
          {
              $whereClause = $whereClause." and duration='$duration'";
          }
  
          $query = "select * from byp_tour where ".$whereClause;
  
          //original query select * from byp_tour where region='$region' and country='$country' and duration='$duration'"
          $tour = mysql_query($query);
          $tourNum = mysql_num_rows($tour);
  
          if($tourNum &gt;0){
  
              while($result=mysql_fetch_array($tour)){
  
                  $tour_name = $result['tour_name'];
                  $tour_detail = $result['tour_detail'];
  
                  echo "Tour Name: $tour_name";  // HERE IS THE OUTPUT RESULT
                  echo "&lt;br /&gt;";
                  echo "Tour Detail: $tour_detail";
                  echo "&lt;br /&gt;";
                  echo "&lt;br /&gt;";
                  echo "&lt;br /&gt;";
              }
          }
          else{
              echo "No Tour Found";
              echo "&lt;br /&gt;";
              echo "&lt;br /&gt;";
          }
      }
  ?&gt;
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;BYP Test&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;form action="searchtest.php" method="post"&gt;
              &lt;div&gt;
                  &lt;label&gt;Region&lt;/label&gt;
                  &lt;select id="region" name="region"&gt;
                      &lt;option value="0"&gt;All&lt;/option&gt;
                      &lt;option value="1"&gt;South East Asia&lt;/option&gt;
                      &lt;option value="2"&gt;Africa&lt;/option&gt;
                      &lt;option value="3"&gt;Europe&lt;/option&gt;
                      &lt;option value="4"&gt;America&lt;/option&gt;
                      &lt;option value="5"&gt;Australia&lt;/option&gt;                               
                  &lt;/select&gt;
              &lt;/div&gt;
              &lt;div&gt;
                  &lt;label&gt;Country&lt;/label&gt;
                  &lt;select id="country" name="country"&gt;
                  &lt;option value="0"&gt;All&lt;/option&gt;
                  &lt;option value="1"&gt;Cambodia&lt;/option&gt;
                  &lt;option value="2"&gt;Thailand&lt;/option&gt;
                  &lt;option value="3"&gt;Vietnam&lt;/option&gt;
                  &lt;option value="4"&gt;Myanmar&lt;/option&gt;
                  &lt;option value="5"&gt;Laos&lt;/option&gt;
                  &lt;option value="6"&gt;Ethiopia&lt;/option&gt;
                  &lt;option value="7"&gt;France&lt;/option&gt;
                  &lt;option value="8"&gt;New York City&lt;/option&gt;
                  &lt;option value="9"&gt;Melbourne&lt;/option&gt;
              &lt;/select&gt;
          &lt;/div&gt;
          &lt;div&gt;
              &lt;label&gt;Duration&lt;/label&gt;
              &lt;select id="duration" name="duration"&gt;
                  &lt;option value="0"&gt;All&lt;/option&gt;
                  &lt;option value="1"&gt;5 Days&lt;/option&gt;
                  &lt;option value="2"&gt;10 Days&lt;/option&gt;
              &lt;/select&gt;
          &lt;/div&gt;
          &lt;input type="submit" name="submit" value="submit" /&gt;
          &lt;/form&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>