lukep11a Posted January 24, 2011 Share Posted January 24, 2011 Hi, I have search form which works apart from 1 part, I have set the results limit to 10 per page with a next link if there are more than 10 results, however when the next link is clicked, i get the error 'you do not have a search parameter' which comes from this code: if (!isset($var)) { echo "<p>We dont seem to have a search parameter!</p>"; exit; } The next link is defined by the code below: // check to see if last page if (!((($s+$limit)/$limit)==$pages) && $pages!=1) { // not last page so give NEXT link $news=$s+$limit; echo " <a href=\"$PHP_SELF?s=$news&q=$var\">Next 10 >></a>"; } Can anyone see where I have gone wrong with this code without me sending the whole search form? Any help would be very much appreciated. Thanks Link to comment https://forums.phpfreaks.com/topic/225557-search-form-results-help/ Share on other sites More sharing options...
codefossa Posted January 24, 2011 Share Posted January 24, 2011 if (!((($s+$limit)/$limit)==$pages) && $pages!=1) { would be if ((($s + $limit) / $limit) != $pages && $pages != 1) { Link to comment https://forums.phpfreaks.com/topic/225557-search-form-results-help/#findComment-1164677 Share on other sites More sharing options...
lukep11a Posted January 24, 2011 Author Share Posted January 24, 2011 thanks, i have tried that and it has the same result Link to comment https://forums.phpfreaks.com/topic/225557-search-form-results-help/#findComment-1164685 Share on other sites More sharing options...
codefossa Posted January 24, 2011 Share Posted January 24, 2011 thanks, i have tried that and it has the same result Sorry, I stopped at the first problem I saw. echo " <a href=\"$PHP_SELF?s=$news&q=$var\">Next 10 >></a>"; try instead echo '$nbsp;<a href="' . $PHP_SELF . '?s=' . $news . '&q=' . $var . '">Next 10 >></a>'; Link to comment https://forums.phpfreaks.com/topic/225557-search-form-results-help/#findComment-1164691 Share on other sites More sharing options...
lukep11a Posted January 24, 2011 Author Share Posted January 24, 2011 No problem, thanks for keep trying for me but it's still not working, it just keeps saying We dont seem to have a search parameter! when I click next Link to comment https://forums.phpfreaks.com/topic/225557-search-form-results-help/#findComment-1164699 Share on other sites More sharing options...
lukep11a Posted January 24, 2011 Author Share Posted January 24, 2011 Thanks for your help, I've managed to sort it... I think! I've just removed the first part and seems to be working.. if (!isset($var)) { echo "<p>We dont seem to have a search parameter!</p>"; exit; } Link to comment https://forums.phpfreaks.com/topic/225557-search-form-results-help/#findComment-1164708 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.