www.tutorialspoint.com Forum Index
Register FAQMemberlistUsergroupsTutorials PointLog in
Reply to topic Page 1 of 1
paging question
Author Message
Reply with quote
Post paging question 
i read the tutorial "Using Paging through PHP" on this web site but there are a few things i need explanation of. i'll be grateful if any experts out there can answer some of my questions:

1. why is there a $_Get{'page'}? i saw most of the tutorials, it used $_Get['page']
2. what is 'page' in $_Get{'page'}? where did it come from?
3. why is that if i used $_PHP_SELF in <a href>, i get a notice saying that in an undefined variable?

these are the three major questions i have in mind..i really do need clarification on these three questions..please help


_________________
christina_rules
View user's profile Send private message
Reply with quote
Post  
Hi Cristina!

Your first and second questions related to $_GET{'page'}: Here is the answer


This is coming from the following setting. Here we are setting page as a part of URL and when we are clicking this URL then it is going to server and we are accessing it using $_GET{'page'}

echo "<a href=\"$_PHP_SELF?page=$last\">Last 10 Records</a> |";
echo "<a href=\"$_PHP_SELF?page=$page\">Next 10 Records</a>";


So here you can use any other name if you don't like page. Because page is more appropriate so most of the developers use page.


You third question: Not sure which variable undefined error you are getting but you need to give one variable like page to store page number so that next time you can jump to next set of pages.

We have given clear example, you are free to copy and past to use that example in your project.


Thanks


_________________
Moderator, TP
Keep visiting and share this site with your friends.
View user's profile Send private message Send e-mail
Reply with quote
Post  
thank you for your information. i appreciate it very much.

my third question was something like this: i followed your example as it is but i've encountered error message that my "$_PHP_SELF" is not defined but when i replace $_PHP_SELF with my page name the error disapppears.

so, instead of
echo "<a href=\"$_PHP_SELF?page=$last\">Last 10 Records</a> |";
i use
echo "<a href=\"mypage.php?page=$last\">Last 10 Records</a> |";

but i don't understand why i'm getting the error. do we have to set it like what we do for for example, $_Post['name']? where we have to isset() it.


_________________
christina_rules
View user's profile Send private message
Reply with quote
Post  
Hi Christina!

Please check your PHP version. This variable contains the script name since PHP 4.3.0. Previously it was not available. Because you provided script name manually so it worked.

Thanks for visiting TUTORIALSPOINT.com


_________________
Moderator, TP
Keep visiting and share this site with your friends.
View user's profile Send private message Send e-mail
Display posts from previous:
Reply to topic Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum