Jump to content

Search form results help


lukep11a

Recommended Posts

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

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>';

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;

          }

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.