-
how to pass arguments fom 1 page to other
hi..
i want to pass some arguments from page 1 to page 2
like i have a increment variable, on page 1 its value is 12 and ,on page 2 i wnat to start its increment from 12 and on poage 3 its vallue should be stated from 24 and so on...
how i can pass these values to variable..?
->and ya,i dont want to pass this value on address bar (through gets)
-> i dont have any form to submit it as a hidden field?
-> should i need a SESSION variable?
plz describe...
-
-
Any of those methods can work.
1. You can pass it through the address bar, if you want to use links. This is the usual method for using "paging" techniques--- "?page=1", etc., and you can just multiply $_GET['page'] by 12.
2. Forms work fine, if you are certain a user will be submitting one. If not, best not to use them because you'd need a backup method anyway.
3. Just start a session, store $_SESSION['var'] = 12;, and move on from there. However, this is not a way to track what pages they came from, where they go next, etc. You could also try that: $_SESSION['var'] = 'currentpagename';
I don't know exactly what you are trying to do, so go ahead and use whatever method is easiest to make work.
I would suggest using get variables, because they are fairly easy to use and they are reliable. It know it makes the page urls look kinda funny, but they are useful and this is how many websites keep track of "location"-- look at this forum, for instance. Any time you have numerical data that changes the content of a page while using the same script, get vars are a great way to go.
The other option here is to do something else entirely:
You could use server side includes (like php's include()) to keep a common script on all of the pages. Then that script could take the page's value-- like "page1" or "page2", as you set it, and decide what to do with "12" from that.
The real question you need to answer is which you want:
1. A system that changes "12" based on the page you are on? (I suggest get vars or the include() idea)
2. A system that changes "12" based on the previous page? (I suggest sessions, or maybe get vars)
Daniel -
Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks