Note that there are some explanatory texts on larger screens.

plurals
  1. POPass value from javascript to PHP
    primarykey
    data
    text
    <p>I am new to scripting and web development. I am displaying a CSV file in the pagination format. The code to display the CSV file is as below. </p> <pre><code>&lt;?php $names = file('demo.csv'); $page = $_GET['page']; //constructor takes three parameters //1. array to be paged //2. number of results per page (optional parameter. Default is 10) //3. the current page (optional parameter. Default is 1) $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;'; //when $row is false loop terminates while ( $row = $pagedResults-&gt;fetchPagedRow()) { echo "&lt;tr&gt;&lt;td&gt;"; //echo '&lt;tr&gt;&lt;th&gt;'.implode('&lt;/th&gt;&lt;th&gt;', $data).'&lt;/th&gt;&lt;/tr&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(); //$data1 = []; $total_columns = 0; $handle1 = fopen('demo.csv', 'r'); while (false !== ($row = fgetcsv($handle1, 1000, ','))) { 0 === $total_columns and $total_columns = count($row); $i = 1; while (++$i &lt;= $total_columns) { $data1[$i][] = (int) $row[$i - 1]; } } $i = 0; while (++$i &lt;= $total_columns) { $_SESSION["min-column-$i"] = min($data1[$i]); $_SESSION["max-column-$i"] = max($data1[$i]); } $_SESSION['totalcolumns'] = $total_columns; fclose($handle1); ?&gt; </code></pre> <p>Now, based on the number of columns of the CSV file I need those many sliders. For the sliders the minimum and maximum values are based on the minimum and maximum values of the columns. The code for that is as below. </p> <pre><code>&lt;?php include 'index.php'; ?&gt; &lt;?php $totalcolumns = $_SESSION["totalcolumns"]; ?&gt; &lt;!-- Activate Simple Slider on your input --&gt; &lt;h2&gt;Keyword Scores&lt;/h2&gt; &lt;?php $i = 1; while (++$i &lt;= $_SESSION['totalcolumns']) { $range = $_SESSION["min-column-$i"] . ',' . $_SESSION["max-column-$i"];?&gt; &lt;br&gt;&lt;?php echo "Keyword" ?&gt; &lt;?php echo $i -1 ?&gt; &lt;br&gt;&lt;input type="text" data-slider="true" data-slider-range="&lt;?php echo $range ?&gt;" data-slider-step="1"&gt; &lt;?php } ?&gt; &lt;form action = "update.php" method="post"&gt;&lt;input type="submit" name="submit"value="SUBMIT"&gt;&lt;/form&gt; &lt;script&gt; $("[data-slider]") .each(function () { var range; var input = $(this); $("&lt;span&gt;").addClass("output") .insertAfter(input); range = input.data("slider-range").split(","); $("&lt;span&gt;").addClass("range") .html(range[0]) .insertBefore(input); $("&lt;span&gt;").addClass("range") .html(range[1]) .insertAfter(input); }) .bind("slider:ready slider:changed", function (event, data) { $(this).nextAll(".output:first") .html(data.value.toFixed(2)); }); &lt;/script&gt; </code></pre> <p>Now, when I select the values in the slider and click on "<strong>SUBMIT</strong>" button, I should get the display of CSV updated accordingly. (i.e) only the rows satisfying the sliders should be displayed. I am not sure of how to do this part as I tried to include one more PHP file. But am not able to pass the values to the PHP file. Can someone please help me on this part?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload