title: PHP - passing variable from one PHP file to another PHP file
body: <p>I am new to PHP and trying to pass variable from one page to another page. Initially, I have a HTML page which contains the frames as below. </p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  
  &lt;frameset cols="70%,*"&gt;
    &lt;frame src="index.php"&gt;
    &lt;frame src="slider.php"&gt;
  &lt;/frameset&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>As seen above, I have 2 PHP pages, in which am trying to send some values from <strong>index.php</strong> file to my <strong>slider.php</strong> file. My <strong>index.php</strong> file is as below. </p>
  
  <pre><code>&lt;?php
  $names = file('demo.csv');
  $page = $_GET['page'];
  $pagedResults = new Paginated($names, 20, $page);
  $handle = fopen('demo.csv', 'r');
    if (($data = fgetcsv($handle, 1000, ',')) !== FALSE)
      {
      }
  echo "&lt;table border='3' bgcolor='#dceba9' style='float:center; margin:50'&gt;";
  echo '&lt;tr&gt;&lt;th&gt;'.implode('&lt;/th&gt;&lt;th&gt;', $data).'&lt;/th&gt;&lt;/tr&gt;';
  while ( $row = $pagedResults-&gt;fetchPagedRow())
  {
      echo "&lt;tr&gt;&lt;td&gt;";
      $row1 = str_replace( ',', "&lt;/td&gt;&lt;td&gt;", $row );
      echo $row1;
      echo "&lt;/td&gt;&lt;/tr&gt;";
  }
  fclose($handle);
  echo "&lt;/table&gt;";
  //important to set the strategy to be used before a call to fetchPagedNavigation
  $pagedResults-&gt;setLayout(new DoubleBarLayout());
  echo $pagedResults-&gt;fetchPagedNavigation();
  ?&gt;
  &lt;form method="get" action="slider.php"&gt;
      &lt;input type="hidden" name="totalcolumns" value="3"&gt;
      &lt;input type="submit"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>This is my <strong>slider.php</strong> file. </p>
  
  <pre><code>&lt;?php 
        $totalcolumns = $_GET['totalcolumns'];
        echo "My next value should get printed";
        echo $totalcolumns;
  ?&gt;
  
    &lt;input type="text" data-slider="true" data-slider-range="100,500" data-slider-step="100"&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>As seen above, I am trying to retrieve the value with the name "<em>totalcolumns</em>". However, I am not able to retrieve the value in my <strong>slider.php</strong> file. I also tried using <strong>SESSION</strong> as suggested in <a href="https://stackoverflow.com/questions/871858/php-pass-variable-to-next-page">this</a> link, but no luck. Can someone please let me know what am doing wrong?</p>