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

Link to comment
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.