[thelist] My Query string not getting results in pages

Steve Lewis slewis at macrovista.net
Mon Nov 18 16:36:01 CST 2002


J Paul Armstrong wrote:

> I'm not sure what you're saying exactly, although I do understand the
> dilemma of passing the query through my link; but I'm not sure of how to do

unfortunately, this page seems to require a significant rewrite that I
cannot invest in right now but here are some hints... a moderate
understanding of php may help you understand what I am trying to do.

> <form action="resulttest.php" method="post">
I recommend a method="get" for search pages.

> <table class="eventContent" cellspacing="0" cellpadding="0" width="360">
> <tr>
>     <td class="eventContent"><b>Search For:</b><br>
>         <select name="searchtype">
>         <option value="all">Select</option>
>         <option value="last">Last Name</option>
>         <option value="first">First Name</option>
>         <option value="title">Title</option>
>         <option value="all">Search All</option>
>         </select></td>
>     <td align="left" valign="top" width="15"><img src="../images/spacer.gif"
> width="15" height="15"></td>
>     <td class="eventContent"><b>Keywords (optional):</b><br><input
> name="searchterm" type="text"></td>

insert here ...

<td class="eventContent"><b>Results per page:</b><br>
<select name="limit">
<option value="5">5</option>
<option value="10" selected>10</option>
<option value="15">15</option>
<option value="20">20</option>
</select></td>

... or something to that effect.  There is nothing special here, its all
just html.  It replaces the links that appear on your page now, which I
have marked below for elimination

> $current = ($pageno/$limit) + 1;


eliminate this block of code.  it is bad, as is passes the query in the URL.
> <tr>
> <td class="searchHead" colspan="2" align="right">Results per-page: <a
> href="<?=$PHP_SELF?>?query=<?=$query?>&pageno=<?=$pageno?>&limit=5">5</a> |
> <a
> href="<?=$PHP_SELF?>?query=<?=$query?>&pageno=<?=$pageno?>&limit=10">10</a>
> | <a
> href="<?=$PHP_SELF?>?query=<?=$query?>&pageno=<?=$pageno?>&limit=20">20</a>
> | <a
> href="<?=$PHP_SELF?>?query=<?=$query?>&pageno=<?=$pageno?>&limit=50">50</a>
> </td>
> </tr>

> echo"<a
> href=\"$PHP_SELF?query=$query&pageno=$back_pageno&limit=$limit\">back</a>\n"
modify this to pass the searchtype and searchterm instead of passing the
query ... something like

?searchtype=$searchtype&searchterm=$searchterm&pageno=$back_pageno&limit=$limit

should do the trick.  this removes the query from the url, but still
passes the 'pageno' that is desired.

> href=\"$PHP_SELF?query=$query&pageno=$ppage&limit=$limit\">$i</a> \n";
Same sort of thing here...

> href=\"$PHP_SELF?query=$query&pageno=$next_page&limit=$limit\">next</a>\n";
and here.

--Steve




More information about the thelist mailing list