@missy_mi
i am trying to do a pagination but, i cant seem to get the problem..
Deos it show any errors? If yes please post the line.
LastMitch
Industrious Poster
4,181 posts since Mar 2012
Reputation Points: 134
Solved Threads: 336
Skill Endorsements: 45
In these parts for back, next etc, shouldn't Page be $Page?
echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page'>Next>></a> ";
AndreRet
Industrious Poster
4,706 posts since Jan 2008
Reputation Points: 391
Solved Threads: 481
Skill Endorsements: 20
@missy_mi
Notice: Undefined index: Page in C:\xampp\htdocs\CDMS\proposals.php on line 302
Instead of this:
$Page = $_GET["Page"];
if(!$_GET["Page"])
{
$Page=1;
}
$Prev_Page = $Page-1;
$Next_Page = $Page+1;
Try this:
$Page = $_GET["Page"];
if($Page == 0) $Page = 1;
$Prev_Page = $Page - 1;
$Next_Page = $Page + 1;
AndreRet is correct about this query being $Page not $Next_Page:
echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page'>Next>></a> ";
It should be $Page not $Next_Page
for($i=1; $i<=$Num_Pages; $i++){
if($i != $Page){
echo "<a href='$_SERVER[SCRIPT_NAME]?Page=$i'>$i</a> ]";
}else{
echo "<b> $i </b>";
}
}
if(!$Page=$Num_Pages){
echo "<a href ='$_SERVER[SCRIPT_NAME]?Page=$Page'>Total Pages</a>";
}else if($Prev_Page){
echo "<a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page'>Prev Page</a>";
}else if ($Next_Page{
echo "<a href='$_SERVER[SCRIPT_NAME]?Page=$Next_Page'>Next Page</a>";
}
LastMitch
Industrious Poster
4,181 posts since Mar 2012
Reputation Points: 134
Solved Threads: 336
Skill Endorsements: 45
I think it's due to this:
$Page = $_GET["Page"];
The only index I can see in the code is the above. It means that the get var hasn't been set yet.
$Page = (isset($_GET["Page"])) ? intval($_GET["Page"]) : 1;
That should safely set your page to the integer value of the get variable if it's set or default to 1.
diafol
Keep Smiling
10,666 posts since Oct 2006
Reputation Points: 1,628
Solved Threads: 1,514
Skill Endorsements: 57
he 1 page shows all the the data i specifically code.. 4 -- $Per_Page = 4; // Per Page ..but it display all.. what do i do??
Sorry, I don't understand
diafol
Keep Smiling
10,666 posts since Oct 2006
Reputation Points: 1,628
Solved Threads: 1,514
Skill Endorsements: 57
@missy_mi
i already change it and there are no more notice that..but, the 1 page shows all the the data i specifically code.. 4 -- $Per_Page = 4; // Per Page ..but it display all.. what do i do??
OK, I'm getting confused too. The issue is that all of the 4 pages appear at once? You want it to display one page at a time?
Can you post your update code so we can see what is the issue?
LastMitch
Industrious Poster
4,181 posts since Mar 2012
Reputation Points: 134
Solved Threads: 336
Skill Endorsements: 45
@missy_mi
it means that all the data is display..instead of just 4 data per page..
do get what i mean??
Can you post your update code not the results. Right now, I don't know what is wrong with your code because you mention you made some adjustments.
LastMitch
Industrious Poster
4,181 posts since Mar 2012
Reputation Points: 134
Solved Threads: 336
Skill Endorsements: 45
@missy_mi
You have a duplicate of this (it should be one):
$Per_Page = 4; // Per Page
The issue is here:
for($i=1; $i<=$Num_Pages; $i++){
if($i != $Page)
{
echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i'>$i</a> ]";
}
else
{
echo "<b> $i </b>";
}
LastMitch
Industrious Poster
4,181 posts since Mar 2012
Reputation Points: 134
Solved Threads: 336
Skill Endorsements: 45
@missy_mi
i dont understand, sir..what seems to be the problem..??
You have a duplicate line 54 and on line 63:
$Per_Page = 4; // Per Page
The issue is here about echo out more than 4 lines:
for($i=1; $i<=$Num_Pages; $i++){
if($i != $Page)
{
echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i'>$i</a> ]";
}
else
{
echo "<b> $i </b>";
}
LastMitch
Industrious Poster
4,181 posts since Mar 2012
Reputation Points: 134
Solved Threads: 336
Skill Endorsements: 45