Re: Page Rendering
| From: | Rick Emery | Date: | Tue, 21 Jan 2003 14:47:38 +0000 |
| Subject: | Re: Page Rendering | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-132411@lists.php.net to get a copy of this message | ||
$PHP_SELF is not interpreted by the browser. The browser shows only what is sent to it; PHP
variables are not sent to the browser.
Take the simple solution: don't use PHP_SELF; just use the file name
----- Original Message -----
From: "Bill Arbuckle, Jr." <bill@wingshooter.net>
To: <php-general@lists.php.net>
Sent: Tuesday, January 21, 2003 8:26 AM
Subject: [PHP] Page Rendering
Hi all. I am having some problems with a script which reads information
from a database and creates a table. It works in IE but not Netscape. I
call myself going through the tags to make sure all that were open were
closed because Netscape doesn't like unfinished business. What I have is a
script that outputs the previous page, 1, 2, ..., next page link (if there
are more than x table items per page). It has worked in both browsers but
now I have broke something. :o) Any ideas are appreciated. The code is
like this ...
<?php
function pagelinks($prev_page, $num_pages, $next_page, $page) {
// This displays the "Previous" link
if ($prev_page) {
echo "<a
href=\"$PHP_SELF?page=$prev_page\">< Prev</a> | ";
}
// No need to output the page number if there is only one page
if ($num_pages>1) {
for ($i = 1; $i <= $num_pages; $i++) {
if ($i != $page) {
echo " <a href=$PHP_SELF?page=$i>$i</a>";
} else {
echo " $i ";
}
}
}
// Display the "Next" link.
if ($page != $num_pages) {
echo " | <a
href=\"$PHP_SELF?page=$next_page\"> Next ></a>" ;
}
}
?>
This code is at the top of an include file which is included in pics.php.
It seems that $PHP_SELF is interpreted differently in *some* instances
between the two browsers. I can't figure it out because PHP_SELF is a
server side evaluation. The links are output correctly in IE ...
http://www.xyz.com/pics.php?page=2 ... but in
Netscape I get ...
http://www.xyz.com/?page=2 I had this problem once before
and inadvertently
fixed it with something else that I was doing. Any hints are appreciated.
TIA,
Bill