Jump to content
Federico

[Solved] How to process "get" input values from a group of checkboxes (multiple combination)

Recommended Posts

Hello processwire community,

this is my very first post, I am newbie in php - trying to test a simple search form which allow frontend user to search and filter data. Macro steps are as follow:

1) Create the form with options as checkboxes, allowing the user to choose multiple values selection within multiple checkbox groups;

2) Create the pw process code in order to revert back the selected items (as a result of multiple checkbox filter combination), allowing pagination as some results may be more than 50 items;

---

Here some of the most related topics I've found over PW forum:

https://processwire.com/talk/topic/7282-paging-issue-with-html-form-check-boxes/

https://processwire.com/talk/topic/3472-enable-pagination-for-search-results/#comment-38214

https://processwire.com/talk/topic/1883-how-to-use-input-whitelist-with-checkboxes-or-any-array/

https://processwire.com/talk/topic/1547-getting-multiple-checkbox-values-within-processwire/

https://processwire.com/talk/topic/1034-search-form-with-multiple-fields/

https://processwire.com/talk/topic/10193-multiselect-search/

---

Now, the html form works just fine (code below), it brings all checked values to the url string. Essentially I have four different groups of checkboxes:

  • cb_sectors[] (multiple pages as categories);
  • cb_expertise[] (multiple pages as categories);
  • cb_status[] (multiple pages as categories); 
  • cb_year[] (integer).

The user may select multiple values within the above four checkbox groups, thus creating even quite complex combination.

<form name='search' id='search-works' method='get' role='form' action='<?php echo $pages->get('/search/')->url; ?>'>

    <div class="collapsible-header">Sector</div>
        <?php foreach($pages->get("/sectors")->children as $sec) echo "
            <p class='checkbox'>
            <input type='checkbox' name='cb_sectors[]' value='{$sec->name}' id='{$sec->name}'/>
            <label for='{$sec->name}'>{$sec->title}</label>
            </p>
        " ?>

    <div class="collapsible-header">Status</div>
        <?php foreach($pages->get("/taxonomy/Status")->children as $st) echo "
            <p class='checkbox'>
            <input type='checkbox' name='cb_status[]' value='{$st->name}' id='{$st->name}' />
            <label for='{$st->name}'>{$st->title}</label>
            </p>
        " ?>

    <div class="collapsible-header no-padding">Expertise</div>
        <?php foreach($pages->get("/expertise")->children as $cb_expertise)
            $checked = $cb_expertise->name == $input->whitelist->cb_expertise ? " selected='selected' " : '';
        echo "
            <p class='checkbox'>
            <input type='checkbox' name='cb_expertise[]' value='{$cb_expertise->name}' id='{$cb_expertise->name}' $checked/>
            <label for='{$cb_expertise->name}'>{$cb_expertise->title}</label>
            </p>
            "
        ?>

    <div class="collapsible-header no-padding">Year</div>
        <?php
        // generate a range of years from '09 to '17, or maybe better doing it via pages as years?
        for($year = 2009; $year <= 2017; $year += 1){
            echo "
            <p class='checkbox'>
            <input type='checkbox' name='cb_year[]' value='$year' id='$year' />
            <label for='$year'>{$year}</label>
            </p>
            ";
        } ?>

    <input class="no-class" type="submit" id="search-submit" name="submit" value="Search">
</form>

The question is then mostly focusing on the second step, the pw process code:

As some previous posts on this topic say - I should (in sequence) sanitize, whitelist and validate the results before pass them to the final output (correct me if I'm wrong). The thing is that I cannot find a way to get all values in a array and sanitize/whitelist/validate them -> some post suggest to use arraytoCSV as a way to let PW remember the filtered items while moving through pagination. Is arraytoCSV the best way to sanitize and whitelist the user input combination?

The following code simply get selected values coming from the above form. As you can see, no sanitize nor whitelist nor validation is in place, as without the array the sanitizing function gives back only the last selected value (not the full combination for every group of checkboxes).

Can you please help me implementing an array within the following code and the way to sanitize - whitelist - validate "get" values? I know for most of you is just as simple as drinking coffe, but would be great if you could drive me in the right direction. Thank you in advance!

<?php namespace ProcessWire;

if(count($input->get)) {

    if($input->get->cb_expertise) {
        foreach ($input->get->cb_expertise as $expertise) {
            // here we are just ensuring submitted products are in fact valid
            echo $expertise;
        }
    }
    if($input->get->cb_sectors) {
        foreach($input->get->cb_sectors as $sector) {
        // here we are just ensuring submitted products are in fact valid
        echo $sector;
        }
    }
    if($input->get->cb_status) {
        foreach($input->get->cb_status as $status) {
            // here we are just ensuring submitted products are in fact valid
            echo $status;
        }
    }
    if($input->get->cb_year) {
        foreach($input->get->cb_year as $year) {
            // here we are just ensuring submitted products are in fact valid
            echo $year;
        }
    }
}

?>
Spoiler

 

 

Share this post


Link to post
Share on other sites

Hi @Federico, welcome to the PW forums. :)

I'm not really clear about what you're asking but here goes...

On 28/01/2017 at 0:27 AM, Federico said:

The thing is that I cannot find a way to get all values in a array and sanitize/whitelist/validate them

You want an array of all GET variables? You can get that by using $input->get() without any argument.

foreach($input->get() as $key => $value) {
    // sanitize each $value as needed, etc
}

But you probably don't want to treat each variable the same, pass it through the same sanitizer, etc. So I think it's more typical to check for the exact named variables you are expecting and ignore anything else that might be there. So for example, for "year" you are expecting an integer so you would apply $sanitizer->inUnsigned().

P.S. take a look at the search template for the Skyscrapers demo - it's a really good demonstration of the basic principles.

  • Like 1

Share this post


Link to post
Share on other sites

Thank you @Robin S for your inputs! 

After tons of tentatives, I've got the whole search engine work. However, now the last missing part: let the pagination work with the search results, as by moving from the page nr. 2 onward, the selectors are not kept in memory/session thus no filter anymore. This is the code:  

<?php if(count($input->get)) {

    $selector = ''; //Selector to store selected inputs 
    $selector .= "template=PageSingleWork, "; //Start concatenation, picking up all pages using this template

    if ($input->get->cb_expertise) {
        foreach($input->get->cb_expertise as $expertise) {
            // Sanitize it
            $exp = $sanitizer->selectorValue($input->get->cb_expertise);
            // Add it to the whitelist... with the same name as the get var!
            $input->whitelist('expertise', $exp);
            $selector .= "expertise=$expertise, ";
        }
    }
    if ($input->get->cb_sectors) {
        foreach($input->get->cb_sectors as $sector) {
            // Sanitize it
            $sec = $sanitizer->selectorValue($input->get->cb_sectors);
            // Add it to the whitelist... with the same name as the get var!
            $input->whitelist('sectors', $sec);
            $selector .= "sectors=$sector, ";
        }
    }
	$works = $pages->find("$selector, limit=3"); //process the inputs to get filtered works
    foreach($works as $work) {
    //here some work...
    }
	$pagination = $works->renderPager();
	echo $pagination;
}
else {
	$works = $pages->find("limit=3"); //process the inputs to get all works as default
    foreach($works as $work) {
    //here some work...
    }
	$pagination = $works->renderPager();
	echo $pagination;
}

 

Something wrong with the whitelist? Probably I have to put whitelist code also outside the foreach statement, in order to keep individual values?

Or probably I have to declare the whitelist even in the html form? 

much appreciated, really

 

Share this post


Link to post
Share on other sites
6 hours ago, Federico said:

However, now the last missing part: let the pagination work with the search results, as by moving from the page nr. 2 onward, the selectors are not kept in memory/session thus no filter anymore.

You shouldn't need to do anything special to get pagination to work with search results.

Make sure you have page numbers enabled for your search template:

2017-01-30_090241.png

Your pagination links (2, 3, 4, etc) should include the GET query string (e.g. "/search/page2?search=foo&year=1985") - do they in your case?

 

Share this post


Link to post
Share on other sites

Thanks again Robin. Yes the template has already the pagination option checked. The weird thing is happening in the url string from page 2 on, as the URL in page 0 is as follow (which is almost ok, although still missing other checkbox empty values):

.../?keywords=&cb_status%5B%5D=ongoing&submit=Search

and from page 1 (or 2) the URL become like this (no more inputs...):

.../?cb_status=array-1

which display clearly all items. It's something I cannot really figure out... I've also tried considering renderToCSV for pagination but no luck

$pagination = $works->renderPager(array('arrayToCSV' => false));

It should be something related to the whitelist, I think i am not storing correctly the get vars

Share this post


Link to post
Share on other sites

After several test, I am pretty sure the problem is given by the wrong white listing approach I am using with checkbox values (array). Here again the html checkbox field example (using "get" form):

 <?php foreach($pages->get("/taxonomy/status/")->children() as $st) {
    $checked = $st->name == $input->whitelist->st ? " selected='selected' " : ''; //HERE PART OF THE PROBLEM, IT DOES NOT CONSIDERING ARRAY
    echo "
    <p class='checkbox'>
    	<input type='checkbox' name='st[]' value='{$st->name}' id='{$st->name}' $checked/>
    	<label for='{$st->name}'>{$st->title}</label>
    </p>
    ";
}
?>

and this it's related process form:

<?php
if($input->get->st) {
    foreach($input->get->st as $st) {
        $san = $sanitizer->selectorValue($st);
        $san = $input->whitelist($st = ''); // THIS FOR ARRAY SEEMS NOT WORKING
        $selector .= "projectStatus=$san, ";
        //$input->whitelist('st', $san); //ALTERNATIVE TO THE ABOVE, AGAIN NOT WORKING FOR ARRAY
    }
}
?>

Someone already faced this issue (not storing the vars array in the whitelist or retrieve them) ? There are some posts in this forum but they look a bit outdated in terms of approach and not referring to the PW latest releases

many thanks in advance!

 

Share this post


Link to post
Share on other sites
29 minutes ago, Federico said:

$checked = $st->name == $input->whitelist->st ? " selected='selected' " : ''; //HERE PART OF THE PROBLEM, IT DOES NOT CONSIDERING ARRAY

Haven't read or understood your whole post but if $input->whitelist->st is an array, and $st->name I guess is a string, in PHP, you cannot compare an array to a string like that. 

Edited by kongondo

Share this post


Link to post
Share on other sites
22 hours ago, Federico said:

$san = $input->whitelist($st = ''); // THIS FOR ARRAY SEEMS NOT WORKING

That isn't valid syntax for whitelist(). See the docs: https://processwire.com/api/ref/wire-input/whitelist/

22 hours ago, Federico said:

//$input->whitelist('st', $san); //ALTERNATIVE TO THE ABOVE, AGAIN NOT WORKING FOR ARRAY

The syntax is valid here, but you'll be overwriting the same whitelist key in each iteration of your loop.

I think you want to set an array to the whitelist key, e.g.

$san_array = array();
foreach($input->get->st as $st) {
    $san = $sanitizer->selectorValue($st);
    $san_array[] = $san;
    $selector .= "projectStatus=$san, ";
}
$input->whitelist('st', $san_array);

// later, call renderPager() with arrayToCSV set false
// or do as Ryan suggests: https://processwire.com/talk/topic/1883-how-to-use-input-whitelist-with-checkboxes-or-any-array/?do=findComment&comment=17706
echo $works->renderPager(array('arrayToCSV' => false));

For the other issue regarding setting the selected attribute of the checkbox you'll want to use in_array.

  • Like 2

Share this post


Link to post
Share on other sites

Thank you @kongondo,

it's a newbie mistake and now I am testing it with in_array function, however seems hard to get the "checked" function work. Here the code:

foreach($pages->get("/sectors/")->children() as $sec) {
  
	if(in_array($sec->name, $input->get->cb_sectors)) { //clearly wrong as it loops against empty array...
  	$selected = ' checked ';
  	}

	echo "
	<p class='checkbox'>
  		<input type='checkbox' name='cb_sectors[]' value='{$sec->name}' id='{$sec->name}' $selected/>
  		<label for='{$sec->name}'>{$sec->title}</label>
	</p>
	";
}

 

Thank you @Robin S ,

it works like charm! :) thank you a lot to sort this out - I will post some final code as soon as it will be ready

Share this post


Link to post
Share on other sites

Which part is not working? Is $selected not getting applied or it is being applied multiple times (even when it shouldn't)? 

Share this post


Link to post
Share on other sites

I guess the $input->get->cb_sectors has to be array since it is checkbox group, but it says in the frontend: "Warning: in_array() expects parameter 2 to be array, null given"

Share this post


Link to post
Share on other sites
2 minutes ago, Federico said:

I guess the $input->get->cb_sectors has to be array since it is checkbox group, but it says in the frontend: "Warning: in_array() expects parameter 2 to be array, null given"

It has to be an array, yes. According to that warning, it says nothing (not empty, but nothing) is being returned by $input->get->cb_sectors. Do you have a typo somewhere? Maybe if we saw the whole code we could better help.

  • Like 1

Share this post


Link to post
Share on other sites

Thank you Kongondo for your help, here the html code:

<form name='search' id='search-works' method='get' role='form'>
	<?php 
	foreach($pages->get("/sectors/")->children() as $sec) {
		if(in_array($sec->name, $input->get->cb_sectors)) { //$input->get->cb_sectors is supposed to be an array, but it outputs nothing instead...
			$selected = ' checked ';
		}
		echo "
		<p class='checkbox'>
		<input type='checkbox' name='cb_sectors[]' value='{$sec->name}' id='{$sec->name}' $selected/>
		<label for='{$sec->name}'>{$sec->title}</label>
		</p>
		";
	}
	?>
  <input class="mettiqualcosaqui" type="submit" id="search-submit" name="submit" value="Search">
</form>
                                        

Here the processor code:

<?php
if(count($input->get)) {

  $selector = ''; //Selector to store selected inputs - and it should have "=" as it is the first in the list
  $selector .= "template=PageSingleWork, "; //Start concatenation, picking up all pages using this template

  if ($input->get->cb_sectors) {
      $se_array = array();
      foreach ($input->get->cb_sectors as $se) {
          $sec = $sanitizer->selectorValue($se);
          $se_array[] = $sec;
          $selector .= "sectors=$sec, ";
  	  }
  	  $input->whitelist('cb_sectors', $se_array);
  }

  $works = $pages->find("$selector, limit=2"); //process the inputs to get filtered works
  $filtered = $pages->find($selector); //process the inputs to get filtered works
  $count = count($filtered); //count found works items

  if($count) { //found items and so display them
      echo "Found $count projects matching your search, using selectors ($selector)<br>";
  {
  else { //no search results
      echo "Sorry, no projects were found that match, using selectors ($selector)<br>";
  }

}
else {
// do something
}
?>

I think the code in the frontend does not retrieve the whitelist array correctly, but all seem to be correct..

Share this post


Link to post
Share on other sites

You are trying to set the selected attribute of the checkboxes based on $input->get, but typically your search attributes should be set based on $input->whitelist. See the Skyscrapers profile for an example: https://github.com/ryancramerdesign/skyscrapers2/blob/master/includes/search-form.php

So you get the whitelist value for the relevant key, which will be an array because that is what you have set to it. Edit: you should first check it with is_array in case nothing has been set to the whitelist yet. And you use in_array against the array for each checkbox value to see if it should be selected.

 

Share this post


Link to post
Share on other sites

I've tried many solution, none of them seem to retrieve correctly the array from the whitelist. The nearest solution to what discussed here is like the following:

if(is_array($input->whitelist('cb_sectors'))) { //check if any array exists 
	if(in_array($cb_sectors->name, $input->whitelist->cb_sectors)) {  //if yes, match the value against the array 
		echo "$cb_sectors->name is checked ";  //just to display if working , but nothing outputs...
	}
}

//alternative to above

if(is_array($input->whitelist->cb_sectors)) { //check if any array exists 
	if(in_array($cb_sectors->name, $input->whitelist->cb_sectors)) {  //if yes, match the value against the array 
		echo "$cb_sectors->name is checked ";  //just to display if working , but nothing outputs...
	}
}

 

Share this post


Link to post
Share on other sites
31 minutes ago, Federico said:

I've tried many solution, none of them seem to retrieve correctly the array from the whitelist.

A little debugging is in order then. You have two variables, $input->whitelist('cb_sectors') and $cb_sectors->name, and you want to know what is in them. You can use basic PHP functions such as var_dump() or print_r(), or you can use the much nicer dumping options in Tracy Debugger.

  • Like 2

Share this post


Link to post
Share on other sites

Thank you Robin,

I've made some testing and debugging (also with tracy debugger) to see what these variables keep while filtering. However everything seems working ok, except when it comes to retrieve data from the stored whitelist...well it says NULL (e.g. never an array, no data, nothing).

I've only managed to retrieve the array by using $input->get instead of $input->whitelist :

<?php
	foreach($pages->get("/sectors/")->children() as $sec) {
        $attrs = array();
        if (is_array($input->get->cb_sectors)) {
            if(in_array($sec->name, $input->get->cb_sectors)) {
            $selected = ' selected="selected"';
        }
    }
    echo "<option $selected value='{$sec->name}'>{$sec->title}</option>";
}?>

which yes retrieve the array but now the issue is that I am going to select all option instead of the only active ones. Weird...

Share this post


Link to post
Share on other sites

If a whitelist value is null then it simply means you have not set anything to it at the time you are checking it.

Going back to the earlier code example, you must set an array to the whitelist...

$san_array = array();
foreach($input->get->st as $st) {
    $san = $sanitizer->selectorValue($st);
    $san_array[] = $san;
    $selector .= "projectStatus=$san, ";
}
$input->whitelist('st', $san_array);

...before you can use the array in $input->whitelist('st') to determine which checkboxes should be selected.

The code above will appear in your search results template, and it must execute before (i.e. above) your code for generating the search inputs. Of course if you are showing your search inputs on other templates besides the search results template then $input->whitelist('st') will be null, but in those cases you don't want any of the inputs to be pre-selected anyway.

  • Like 1

Share this post


Link to post
Share on other sites

As you recommended, reversing the position of the php processing code before the html form, made the trick and now the whitelist start populating - sorry to raise such silly issues... :)

maybe you know what is the best approach on defining which input (checkbox in this case) should be marked as "checked" by matching the string value against the whitelist array. I mean, I get the "checked" feature for all the checkboxes, regardless of the options really selected. In_array works perfectly (thanks again!), I think I should first validate which option to check before outputting the $checked variable like the following. Do you have better suggestion?

<form name='search' id='search-works' method='get' role='form'>
	<?php 
	foreach($pages->get("/sectors/")->children() as $sec) {
		if(is_array($input->whitelist->cb_sectors)) { 
			if(in_array($sec->name, $input->whitelist->cb_sectors)) { 
			$selected = ' selected ';
			//$selected['selected'] = 'selected'; //Working  alternative?
			}
		}
		echo "
		<p class='checkbox'>
		<input type='checkbox' name='cb_sectors[]' value='{$sec->name}' id='{$sec->name}' $selected/>
		<label for='{$sec->name}'>{$sec->title}</label>
		</p>
		";
	}
	?>
  <input class="class" type="submit" id="search-submit" name="submit" value="Search">
</form>

 

Share this post


Link to post
Share on other sites

You need to initialise/reset the $selected variable in each iteration of the loop. Otherwise two things will happen:

1. If the first child of /sectors/ is not in the whitelist array you will get an undefined variable notice.

2. After one child name is found in the whitelist array and $selected is defined as ' selected ' then all subsequent iterations will output ' selected ', regardless of if that input is in the whitelist array or not. This is the problem you are getting now.

So it should be something like:

foreach($pages->get("/sectors/")->children() as $sec) {
    $selected = '';
    if(is_array($input->whitelist->cb_sectors) && in_array($sec->name, $input->whitelist->cb_sectors)) $selected = ' selected ';
    // echo, etc...
}

 

  • Like 1

Share this post


Link to post
Share on other sites

Brilliant! I should pay you at least a couple of beers... :)

I'll mark this thread as solved, thank you Robin for you inputs!

regards 

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By daniel_puehringer
      Hi community, thanks for the great work you do 🙂

      I´m looking for a global field which can be used in the footer and has only one instance for all pages. So I´m kind of looking for "One field to rule them all".
       
      Reason for my question: The website I´m currently building has one footer for all pages. The content of the footer should be dynamic - therefore I made a global field which is automatically inserted into each page.
      Problem: if I want to change something in the footer, I have to do it for all fields, because each field has it´s own instance.

      Question: is it possible to have one global field in which changes the content for the footer of all pages?

      In most CMS Systems a simple solution to this is often impossible, I hope that processwire is different 🙂

      All the best,
      Daniel
       
    • By sebr
      Hi
      In my search page, I used a selector like this :
      $searchQuery = $sanitizer->entities($input->get('q')); $searchQuery = $sanitizer->selectorValue($searchQuery); $selector = 'title|subtitle|summary|html_body_noimg~=' . $searchQuery; $matches = $pages->find($selector); I don't have the same results if $searchQuery contains accent or not.
      For example,
      with « bâtiment » I have no result with « batiment » I have onea result : « Les bâtiments et les smart-city » Normally I should have the same results? How can I do that ?
      Thanks for your help
    • By michelangelo
      Hello guys, I am building a sort of an archive. Relatively simple, although I have about 8000 records, each with 15 fields (text, int, images, url). I created a crude search system with a form (emulating the famous Skyscrapper example) to filter through the system. Everything works but it is quite slow... I have 2 questions which are related:

      1. How can I search through the database?
      2. What is a good practice to display many records like these?
      -----------------------------------------
      1. I am retrieving the results with
      $songs = $pages->findMany('template=nk-song'); Then I do a foreach to render them all. I am unsure if that is a good way. If I render all of them on the page, it creates thousands of divs with a bit of text, and this can take a while (10s-15s).
       
      2. This one is even worse :D as every time I retrieve my desired records with something like this:
      $page->find("field_to_search_through~=my_query_string") I get between 20 and 200, but when I render them I am creating iframes with YouTube videos and that can take up to 10s to finish. I "solved" it by only loading the iframes if they are in view with IntersectionObserver on the client-side. But I feel there is a more precise PHP / ProcessWire approach.
       
      Just to clarify, I started doing all of this custom rendering and querying because tools like ElasticSearch or SearchEngine were a bit complicated and I needed a simple to retrieve information and then display it in my own way.
      Thank you!
    • By snobjorn
      I have a website with multiple content types that I want to be accessible through search. I really like the live search on processwire.com, that sorts content types while typing. I tried to find the code to recreate this, with no luck. Does anyone know if this is jquery, specific jquery plugins, json/xml cached files, and what kind of PHP code is used? Any tip that point me in the right direction would be much apperciated.
      The search result listing seems fairly easy to create with sorting through parameters.
    • By jacmaes
      I have a series of videos, and the following search form (translated into English here) that allows to filter these videos on the frontend:

      I've built a few of these search forms, but only with text fields, selects and radio buttons. Here I'm using an array with checkboxes ("Level" field above), and it's causing me grief when I try to paginate these results. I've done a lot of searching in the forum and spent too many hours to try to get it to work. Here's how I'm building the selector:
      <?php if(count($input->get)): // Level is an array. Code adapted from Ryan's snippet here: // https://processwire.com/talk/topic/3472-enable-pagination-for-search-results/?tab=comments#comment-38042 if($input->get->level) { $level = array(); foreach($input->get->level as $id) $level[] = (int) $id; // sanitize to INTs $level = implode('|', $level); // convert to 123|456|789 string, ready for selector } else { $level = ''; } $data = array( 'training_type' => array('=', (int) $input->get->training_type), 'duration' => array('=', (int) $input->get->duration), 'level' => array('=', $level), 'limit' => array('=', (int) $input->get->limit) ); $selector = ''; // iterate through the $data we made above to create a selector string foreach($data as $field => $a) { list($operator, $value) = $a; if(empty($value)) continue; // send value to the whitelist so that it can be used in pagination $input->whitelist($field, $value); // append to our selector string $selector .= "$field$operator$value, "; } $videos = $page->children("$selector"); When I hit search, I get the expected results. So far so good. The GET parameters are the following with the options selected in the screenshot above:
      videos/?level[]=1476&level[]=1477&training_type=1473&duration=1485&limit=10 $selector echoes the following as the "level" field is an array with a pipe character:
      level=1476|1477, training_type=1473, duration=1485, limit=10 Now, when paginating these results, the following page (page 2) shows these GET parameters:
      videos/page2/?level=1476|1477&training_type=1473&duration=1486&limit=10 And I think that's where the problem lies. The "level" field is "lost" and I'm getting more results than expected on subsequent pages. If I manually add "page2" to the initial results in the URL, just to test, everything works fine:
      videos/page2/?level[]=1476&level[]=1477&training_type=1473&duration=1486&limit=10 But how can I achieve this in code? Do I need to revert to "level[]=1475&level[]=1477" instead of "level=1476|1477" for the pagination to work correctly, and can you PHP gods illuminate me?
      Any help would be really appreciated, really.
×
×
  • Create New...