On a search engine for my website I use a html form to send a value to the next page then that page processes it and creates several pages on which the results will be spread out between.

This is the part of the php script which GETs the variable to process and see if there'a match of it within the database:

$var = @$_GET['q'] ;
if (!isset($var))
  {
  echo "<p>Please enter a term or phrase to search</p>";
  exit;
  }

The problem is that once I click on the page number 2, 3, 4.... the $var isn't gotten because it hasn't been sent again so I get the message saying "Please enter a term or phrase to search". I know there's a way to send it through href links but have no idea where to place it or how to. I've tried several ways of putting it in but it didn't work.

Here's the script for one of the links which goes to the next page of results.

$pagination.= "<a href=\"$targetpage?page=$next\" >next » </a>";

Can I insert that word which was searched for into the link above so it can be gotten again by the " $var = @$_GET ;" line at the top of the script

Your code is very unclear but I will still tell u a solution what I feel is correct.

From:
$pagination.= "<a href=\"$targetpage?page=$next\" >next » </a>";

To:
$pagination.= "<a href=\"$targetpage?q=<?php echo $var; ?>&page=$next\" >next » </a>";

if you still have any issues, mail me your script at vaibhav [at] blogskulz [dot] com
I will take a look

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.