PHP paging problem
How do you pass a search string in paging???
Hello, my name is johan. Right now i am developing a
system using PHP
and MySQL. I have a paging problem. The paging works
when i want to
display all the person from all countries BUT it
does'nt work when i
search for a particular person from a certain
countries. My problem
is when i search for a participant from country
Canada, the first
page will display correctly all the person from
country Canada ONLY
in Page2. But when i click on the link "Previous",
"Next", "Page2,
Page3......", it will display all the person from
all countries. Is
it because i did not carry the variable of what i search for to
other pages? Do you
know what is causing the problems?
Eg. I have 2 pages.
Page1 is the search form
Page2 is display the paging of my search results.
Does anybody have a sample code on how to pass a search variable in the link to different pages????
This is my query:
$query = "SELECT * FROM person, tablecountry, tablecourse, course WHERE Name LIKE '$name1%' AND FamilyName LIKE '$name2%' AND Year attended LIKE '$tahun%' AND Country LIKE '$country%'"
. " AND person.KodCountry=tablecountry.KodCountry AND person.IDPerson=course.IDPerson AND course.KodCourse=tablecourse.KodCourse order by Name ";
$result = mysql_query($query);
echo "<a href=\"searchperson.php? WHAT SHOULD I INSERT HERE?????">Page$i</a>";
|