Gah!  Forgot an element for that form:  Page element.

<INPUT TYPE="hidden" NAME="page" VALUE="<? echo "$next_page"; ?>">

:)


> Hi Richard.
>
> Two methods, POST and GET:  Post for forms and best works with hidden
> elements.
>
> Get can be put across URL's:
>
> echo "<a href=\"$PHP_SELF?page=$next_page&$metode=$search\">Next</a>";
>
> Or
>
> <FORM ACTION="<? echo "$PHP_SELF"; ?>" METHOD="POST">
> <INPUT TYPE="hidden" NAME="<? echo "$metode"; ?>" VALUE="<? echo
"$search";
> ?>">
> <INPUT TYPE="Submit" NAME="Submit" VALUE="Next">
> </FORM>
>
> Of course form buttons look dreadful, so if you use that method, create a
> graphic to use, or do a javscript work around for text links. Hope that
> helps :)
>
> James.
>
> "Richard Kurth" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> >   I am having a problem with this script. It works perfect if I just do
> >   a Query like ("SELECT * FROM customers") but if I call it from
> >   another script with a form to set the search criteria for this Query
> >    ("SELECT * FROM customers WHERE $metode LIKE '%$search%'") It will
> >    show the first page but it gives me a error for any other page the
> >    problem is it does not pass the $metode $search on to the next page
> with
> >    PHP_SELF (look at bottom of script) How can I make it retain the
> >    variables to the next page?
> >
> > // Number of entries per page
> > $per_page = 3;
> > $sql_text = ("SELECT * FROM customers WHERE $metode LIKE '%$search%'");
> >
> >
> > // Set page #, if no page is specified, assume page 1
> > if (!$page) {
> >    $page = 1;
> > }
> > $prev_page = $page - 1;
> > $next_page = $page + 1;
> >
> > $query = mysql_query($sql_text);
> >
> > // Set up specified page
> > $page_start = ($per_page * $page) - $per_page;
> > $num_rows = mysql_num_rows($query);
> >
> >
> > if ($num_rows <= $per_page) {
> >    $num_pages = 1;
> > } else if (($num_rows % $per_page) == 0) {
> >    $num_pages = ($num_rows / $per_page);
> > } else {
> >    $num_pages = ($num_rows / $per_page) + 1;
> > }
> > $num_pages = (int) $num_pages;
> >
> > if (($page > $num_pages) || ($page < 0)) {
> >
> > }
> > //
> > // Now the pages are set right, we can
> > // perform the actual displaying...
> > $sql_text = $sql_text . " LIMIT $page_start, $per_page";
> > $query = mysql_query($sql_text);
> > ?>
> > <table border="1" align="center">
> > <tr align="center" valign="top" bgcolor="#86B3E3">
> >         <td><h3>Plan</h3></td>
> >         <td><h3>Domain</h3></td>
> >         <td><h3>First Name</h3></td>
> >         <td><h3>Last Name</h3></td>
> >         <td><h3>Company</h3></td>
> >         <td><h3>Email</h3></td>
> >         <td><h3>User Name</h3></td>
> >         <td><h3>Password</h3></td>
> > </tr>
> > <?
> > //$query = mysql_query("SELECT * FROM customersWHERE $metode LIKE
> '%$search%' LIMIT 0, 30 ");
> > while ($row  =  mysql_fetch_array($query))
> >    {    $plan=$row["plan"];
> >                 $domaname=$row["domaname"];
> >         $fname=$row["fname"];
> >         $lname=$row["lname"];
> >                 $company=$row["company"];
> >                 $email=$row["email"];
> >                 $cusername=$row["cusername"];
> >                 $cpassword=$row["cpassword"];
> >                 echo "<tr align='center'>";
> > print
>
("<td><strong>$plan</strong></td><td><strong>$domaname</strong></td><td><str
> ong>$fname</strong></td>
>
<td><strong>$lname</strong></td><td><strong>$company</strong></td><td><stron
>
g>$email</strong></td><td><strong>$cusername</strong></td><td><strong>$cpass
> word</strong></td><br>");
> > echo "</tr>";
> >    }
> > echo "</table>";
> > // Previous
> > if ($prev_page)  {
> >    echo "<a href=\"$PHP_SELF?page=$prev_page\">Prev</a>";
> > }
> >
> > // Page # direct links
> > for ($i = 1; $i <= $num_pages; $i++) {
> >    if ($i != $page) {
> >    echo "<a href=\"$PHP_SELF?page=$i\">$i</a>";
> >    } else {
> >       echo " $i ";
> >    }
> > }
> >
> > // Next
> > if ($page != $num_pages) {
> >    echo "<a href=\"$PHP_SELF?page=$next_page\">Next</a>";
> > }
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > Best regards,
> >  Richard
> > mailto:[EMAIL PROTECTED]
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to