Yes I am new to PHP so here is my problem.
I am trying to create navigation buttons to move thru my web site. I have a mysql database with a table filled with names and pages.
I have a file called "MYFUNCTIONS.php" Here I have a function for turning on and off the database, and a function which will show you all the items which are passed into the file. Lets give the function the name "pictures."
DATABASE
name page
bob 2
sam 2
mike 3
sue 3
If iI create a index.php and call the function pictures(2)
I have the function created to show me all the names related to page 2
If I change the code and say pictures(3) then all the names on three will show.
THE QUESTION!!!!! How could I get the page to be seen user friendly. In other words I know how to create <- and -> arrows to move to new pages in html, but in PHP what do I need to do in my index.php to have a user control the function and send it as pictures($page) or something like that... all dependent on if they click the forward or back buttons on my site?
I hope you understand my question. Thanks in advanced for any help I receive.
I can also be reached at feger585@yahoo.com
Fegero
create forward buttons - html - php
Moderator: General Moderators
I'll make this simple
How can I make a user change the variable in the index file to be passed off the the Function scripts.
INDEX.php MyFunctions($bob);
FUNCTIONS.INC - search the database for $bob
I only need to make the user change $bob
Yes, I'am getting $#@$@# (upset) with my knowledge limitations in PHP.
Thanks again.
INDEX.php MyFunctions($bob);
FUNCTIONS.INC - search the database for $bob
I only need to make the user change $bob
Yes, I'am getting $#@$@# (upset) with my knowledge limitations in PHP.
Thanks again.
I guess I did not explain well
Passing the variables between pages is not the problem. I have that down fine. What I am trying to do right now is knowing how to have the end user manipulate the variable in HTTP/PHP. using an icon.
Again what I am trying to do is have the FILE.php be the page the user sees. On that page the default would be page 2. That person now has the option to pick the Right Icon to go to page 3 or the LEFT icon to go to page 1. Once chosen, the function would be called to change the data.
Now my question would be... What do I need to do to be able to create a icon inorder for the user to change pages? If they click on the RIGHT button then I would want to
$current_page +1;
myfunction($current_page)
So how do I make a button to control the variable before its passed to the function?
Again what I am trying to do is have the FILE.php be the page the user sees. On that page the default would be page 2. That person now has the option to pick the Right Icon to go to page 3 or the LEFT icon to go to page 1. Once chosen, the function would be called to change the data.
Now my question would be... What do I need to do to be able to create a icon inorder for the user to change pages? If they click on the RIGHT button then I would want to
$current_page +1;
myfunction($current_page)
So how do I make a button to control the variable before its passed to the function?
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
Basically you don't create a button to control the variable and the end user doesn't manipulate it either. PHP is server-side which means that the server does all the work and all the client's browser sees is HTML (and Javascript if you've got it) code. You don't use links to call functions - you can't PHP is not like Javascript which is client-side and therefore run by the browser.
The easiest thing you can do is pass the page number in the URL as a query string. For example you could have URL's which look like this:
Then using the value for page number set in the URL you can do something like the following:
Then you can add this information to the next and previous buttons as well as to whatever code that includes the actual page content. So your previous button would look something like:
and you'd have something almost identical (previous replaced with next) for the next button.
Mac
The easiest thing you can do is pass the page number in the URL as a query string. For example you could have URL's which look like this:
Code: Select all
http://www.yoursite.com/articles/something.php?pageno=2Code: Select all
if (isset($_GETї'pageno']) {
$page_number = $_GETї'pageno'];
} else {
$page_number = 1;
}
$page_number_next = $page_number + 1;
$page_number_prev = $page_number - 1;Code: Select all
echo '<a href="something.php?pageno='.$page_number_prev.'"><img src="prevbutton.gif" width="x" height="y" alt="Previous Page ('.$page_number_prev.')" /></a>';Mac
Thanks, it sounds good
For some reason that is what I thought I would be doing. Thanks for the info. I'll give this a try for a while and see what happens.
Thanks again
Fegero
Thanks again
Fegero