Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3348590
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T01:33:40+00:00 2026-05-18T01:33:40+00:00

Im trying to do pages for my search result.My Search function is working fine.

  • 0

Im trying to do pages for my search result.My Search function is working fine. However, when I click on the page number. This error appears (below) :

Notice: Undefined index: search in C:\wamp\www\I-Document\new.php on line 8
ERROR: Select from dropdown

This message only should appear when there is no input in dropdown and no search input.
Im not sure how to correct this. Please help! Thank u

<?php

//connecting to the database
include 'config.php';


$search = mysql_escape_string($_POST['search']);

$dropdown = mysql_escape_string($_POST['dropdown']); 

if (empty($search) && empty($dropdown)) {
die("Please choose your Search Criteria");
  } 

  //max displayed per page
  $per_page = 10;

  //get start variable  
  $start = $_GET['start'];

  //count records
  $record_count = mysql_query("SELECT COUNT(*) FROM document WHERE $dropdown LIKE     '%$search%'");


  //count max pages
  $max_pages = $record_count / $per_page; 

  if (!$start)
    $start = 0;

    //display data
    $query = mysql_query("SELECT * 
                            FROM document 
                           WHERE $dropdown LIKE '%$search%' 
                           LIMIT $start, $per_page");

    echo "<b><center>Search Result</center></b><br>";

    $num=mysql_num_rows($query);

    if ($num==0)
      echo "No results found";
    else {
      echo "$num results found!<p>"; 
    }

  echo "You searched for <b>$search</b><br /><br /><hr size='1'>";
  echo "<table border='1' width='600'>
          <th>File Reference No.</th>
          <th>File Name</th>
          <th>Owner</th>
          <th>Borrow</th>
       </tr>";

  while ($rows = mysql_fetch_assoc($query)) {
    echo "<tr>";
    echo "<td>". $rows['file_ref']  ."</td>";
    echo "<td>". $rows['file_name'] ."</td>";
    echo "<td>". $rows['owner'] ."</td>";
    echo "<td><a href=add_borrower.php?id=" . $rows['id'] . ">Borrow</a></td>";
    echo "</tr>";
  }

  echo "</table>"; 

 //setup prev and next variables
 $prev = $start - $per_page;
 $next = $start + $per_page;

 //show prev button
 if (!($start<=0)) 
   echo "<a href='new.php?start=$prev'>Prev</a> ";

 //show page numbers
 //set variable for first page
 $i=1;

 for ($x=0;$x<$record_count;$x=$x+$per_page) {
   if ($start!=$x)
     echo " <a href='new.php?start=$x'>$i</a> ";
   else
     echo " <a href='new.php?start=$x'><b>$i</b></a> ";

   $i++;
}
}

//show next button
if (!($start>=$record_count-$per_page))
  echo " <a href='new.php?start=$next'>Next</a>";

?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T01:33:40+00:00Added an answer on May 18, 2026 at 1:33 am

    Looks to me like when you click on a link, you no longer have the POST data being sent (it becomes a simple GET request). You’ll need to create a form, then have a submit button for each of the pages. Or have the search term in the Query String, like Google (google.com/search?q=your+search+term+here)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write a query for an advanced search page on my document
I'm trying to page a table, and while I have paging already working, it
I'm trying to open read a page on my own website for a search
I'm trying to add a search box to a master page in an ASP.Net
i am trying to grab links from the Google search page. i am using
I am working on a search web page for my site. The requirements state
I'm trying to fetch Wikipedia pages using LWP::Simple , but they're not coming back.
I'm trying to localize my aspx pages. I'm done with content localization using L10n
I've got a lot of pages in my site, I'm trying to think of
I am trying to use page methods in my asp.net page. I have enable

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.