HartleySan Posted December 11, 2013 Share Posted December 11, 2013 Wagtail, as Antonio suggested, are you echoing everything out at various stages of your script, and is everything set as is expected? Link to comment Share on other sites More sharing options...
Wagtail Posted December 12, 2013 Author Share Posted December 12, 2013 Hi HartleySan, I have been “echoing out” the variables and the problem seems to be the $start and $_GET['s'] variables. When a checkbox has been selected, the page will load and display a certain number of pagination links (numbers) depending on the total number of results. I now click to page 4 (as an example). On page 4, I select another checkbox and load the page. The page will load but will display the same current pagination link as before I selected a new checkbox. The $_GET['s2'] variable already has a value of 4 and so this value is assigned to the $start variable. I don't know if I can use a loop to say that every time the $string variable is set the below code will run from the beginning again. // Determine where in the database to start returning results... if (isset($_GET['s']) && is_numeric($_GET['s'])) { $start = $_GET['s']; } else { $start = 0; } Will keep on trying. Thank you for your help. Link to comment Share on other sites More sharing options...
HartleySan Posted December 12, 2013 Share Posted December 12, 2013 I thought we already discussed this issue. Whenever you make a new Ajax request, please reset the $start variable to 0. Link to comment Share on other sites More sharing options...
Wagtail Posted December 12, 2013 Author Share Posted December 12, 2013 Hi, I have tried setting $start to 0 but it didn't work. Where exactly should I put this? Putting $start = 0 directly after if (isset($string)) didn't work. I first need to get the checkboxes working with PHP before I can try the Ajax. Link to comment Share on other sites More sharing options...
HartleySan Posted December 12, 2013 Share Posted December 12, 2013 I would think that when you initiate the Ajax request, you would pass the URL parameter start=0 to the PHP script. Is that a viable option? Link to comment Share on other sites More sharing options...
Wagtail Posted December 13, 2013 Author Share Posted December 13, 2013 I first need to get the checkboxes working with PHP before I can try the Ajax. Sorry, by this I meant to say that the script has to work with JavaScript disabled before I can add the Ajax functionality. Link to comment Share on other sites More sharing options...
HartleySan Posted December 13, 2013 Share Posted December 13, 2013 Whether it be JS/Ajax or PHP only, the concept is the same. When you add a new filter, set $start to 0. That make sense? 1 Link to comment Share on other sites More sharing options...
Wagtail Posted December 14, 2013 Author Share Posted December 14, 2013 Hi HartleySan, thanks for your assistance. I am going to leave this checkbox stuff for the moment and concentrate on other parts of the website. Link to comment Share on other sites More sharing options...
HartleySan Posted December 14, 2013 Share Posted December 14, 2013 All right. Best of luck. Link to comment Share on other sites More sharing options...
Recommended Posts