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.
<!DOCTYPE html>
<html>
<frameset cols="70%,*">
<frame src="index.php">
<frame src="slider.php">
</frameset>
</html>
As seen above, I have 2 PHP pages, in which am trying to send some values from index.php file to my slider.php file. My index.php file is as below.
<?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 "<table border='3' bgcolor='#dceba9' style='float:center; margin:50'>";
echo '<tr><th>'.implode('</th><th>', $data).'</th></tr>';
while ( $row = $pagedResults->fetchPagedRow())
{
echo "<tr><td>";
$row1 = str_replace( ',', "</td><td>", $row );
echo $row1;
echo "</td></tr>";
}
fclose($handle);
echo "</table>";
//important to set the strategy to be used before a call to fetchPagedNavigation
$pagedResults->setLayout(new DoubleBarLayout());
echo $pagedResults->fetchPagedNavigation();
?>
<form method="get" action="slider.php">
<input type="hidden" name="totalcolumns" value="3">
<input type="submit">
</form>
This is my slider.php file.
<?php
$totalcolumns = $_GET['totalcolumns'];
echo "My next value should get printed";
echo $totalcolumns;
?>
<input type="text" data-slider="true" data-slider-range="100,500" data-slider-step="100">
</html>
As seen above, I am trying to retrieve the value with the name "totalcolumns". However, I am not able to retrieve the value in my slider.php file. I also tried using SESSION as suggested in this link, but no luck. Can someone please let me know what am doing wrong?