473,395 Members | 1,556 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Carrying PHP Variables From Web Page To Web Page

I was reading about PHP variable scoping - it doesn't seem to support
carrying any variables from one web page to another - how is this
usually done? I have a lot of php variables created on my home page
that I need to make use of on other web pages - how can I do that?

Thanks...

Jul 16 '05 #1
3 6255
> 3 choices
1) use sessions to hold the variables between pages
2) use hidden form fields and submit buttons (not secure)
3) use a database to hold the values and embed the key in your urls (e.g.
href='somepage.php?id=34')


.... of which sessions (option 1) is the best option, since that effectively
stores the values on the server as in option 3, but can pass the 'key' from
option 3 either as a cookie, form fields as in option 2 or as part of the
link, again from option 3.

David
Jul 16 '05 #2
Wm
Is it possible to do something like this:

Form on page1: POST to page2
Page2: extract($_POST)
hyperlink to Page3: <A HREF="page3.php?data=_POST">continue</A>

(I know it won't work as written, but is something similar possible?)

Wm
"David Walker" <wb*********@hotmail.com> wrote in message
news:bg**********@wisteria.csv.warwick.ac.uk...
3 choices
1) use sessions to hold the variables between pages
2) use hidden form fields and submit buttons (not secure)
3) use a database to hold the values and embed the key in your urls (e.g. href='somepage.php?id=34')
... of which sessions (option 1) is the best option, since that

effectively stores the values on the server as in option 3, but can pass the 'key' from option 3 either as a cookie, form fields as in option 2 or as part of the
link, again from option 3.

David

Jul 16 '05 #3
> Form on page1: POST to page2
Page2: extract($_POST)
hyperlink to Page3: <A HREF="page3.php?data=_POST">continue</A>


As far as I know, you could only do this if your hyperlink was actually a
submit button of a form which was pre-filled in with the values you want to
pass on - which would require javascript and is more of a bodge than a real
solution. If theres not much data you could use GET, which can just be
added onto the end of the hyperlink as you show, but not with POST, which
can be much much longer. I would still recommend sessions for this - then
you only need to pass the session ID (which is automatic in most cases
anyway) and then the rest can be left in the session. Unless your server
hasn't been updated for quite some time, it should have session support and
i can't think of any disadvantages to using that instead of passing
variables around multiple times from many pages - apart from anything else
if it is a lot of data then its being sent to and from the client at least
twice more then what it needs to.

David
Jul 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

36
by: Richard | last post by:
My employer currently pays me $1/hour when I carry a pager. I have to carry the pager every fourth week. The problem is that my employer insists that I be available when I'm carrying the pager. ...
4
by: Ivan Shevanski | last post by:
Alright heres my problem. . .Say I want to carry over a variable from one function to another or even another run of the same function. Is that possible? Heres a quick example of what I'm talking...
1
by: Ani | last post by:
Hi, I need to carry the user input across pages and then at the end insert all the values into the DB. How do I best accomplish this task in ASP.Net. I am a novice , please give me some simple...
1
by: jamezw | last post by:
I have a web app that uses StateServer to track session. It is cookieless (e.g. session ID in the URL.) We have run into a problem that is like such: we have a page that has multiple frames on it....
4
by: Matt | last post by:
I have the following in a page and I am trying to update a record on the next page but for some reason the form data is not carrying over. Any ideas why? <form name=nxtlupdate method=post...
1
devonknows
by: devonknows | last post by:
Hi, im having trouble carrying variables across a form, ive looked on here and other sites but cant find anything that helps me, or i might not be searching for the right terms, so i though i would...
4
by: Kurrent | last post by:
I have some data from text fields that are being passed over through a form that I am displaying with the $_POST superglobal. Once i have echo'd out this data onto the next page, i'd like to...
4
by: dpinion | last post by:
Greetings, I am trying to do some simple session stuff. However it does not seem as though the session variable is being created for my site. I am running the latest version of PHP and apache that...
4
cassbiz
by: cassbiz | last post by:
Could use some help here. This script is carrying over an image just fine but the text isn't coming over. can you see why it is not working???? from the form I want to carry over two lines of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.