473,379 Members | 1,255 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,379 software developers and data experts.

PHP data persistence without forms or GET methods?

I need to be able to make a variable persistent between page
invocations without submitting a form or sending it as a name-value
pair in the URL. Another requirement I have is that I can't store the
data in a cookie or a file either. Are there any solutions to this
problem?
Jun 2 '08 #1
16 1762
se************@gmail.com schreef:
I need to be able to make a variable persistent between page
invocations without submitting a form or sending it as a name-value
pair in the URL. Another requirement I have is that I can't store the
data in a cookie or a file either. Are there any solutions to this
problem?
Well, SESSION is the way to go.

You were not completely clear if a sessionid is allowed in the
url/form/cookie (it can be passed around via all 3).

read more here:
http://nl2.php.net/manual/en/book.session.php

If that is no option I cannot think of anything else.
This is what sessions were made for.

Regards,
Erwin Moller
Jun 2 '08 #2
Thank you very much.

Cheers,
- Sebastian
Jun 2 '08 #3
I am assuming then that there is no way to simulate that a form has
been submitted (ie: by emedding a form with a hidden element into an
anchor tag, for instance)?

Jun 2 '08 #4
se************@gmail.com schreef:
I am assuming then that there is no way to simulate that a form has
been submitted (ie: by emedding a form with a hidden element into an
anchor tag, for instance)?
Hi Sebastian,

I cannot follow what it is that you want to accomplish.
You said earlier you do not want to use a form to propagate information.
Now you suggest to use a form to do excactly that.

Please state your problem clearly, maybe we can help.
Like this I am shooting in the dark. :-/

Regards,
Erwin Moller
Jun 2 '08 #5
You said earlier you do not want to use a form to propagate information. Now you suggest to use a form to do excactly that.

The problem is that most of the navigation by the user will be via
links. I could of course imbed the variables in the URL but I would
prefer not to send some of that information 'in the clear'. Ideally, I
would like to send them along as a post request, but I don't see how
this is possible without using forms.
Jun 2 '08 #6
Well, anyway, your suggestion to use sessions seems like the best
option. Thank you for your time and input.

Regards,
- Sebastian
Jun 2 '08 #7
se************@gmail.com wrote:
>You said earlier you do not want to use a form to propagate information. Now you suggest to use a form to do excactly that.

The problem is that most of the navigation by the user will be via
links. I could of course imbed the variables in the URL but I would
prefer not to send some of that information 'in the clear'. Ideally, I
would like to send them along as a post request, but I don't see how
this is possible without using forms.
It's not.

As Erwin said - use sessions.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Jun 2 '08 #8
se************@gmail.com wrote:
I am assuming then that there is no way to simulate that a form has
been submitted (ie: by emedding a form with a hidden element into an
anchor tag, for instance)?

If you set hidden variables and SUBMIT - via javascript if necessary - a
pseudo form, then you can pass post variables.

What is wrong with a form anyway?

Jun 2 '08 #9
se************@gmail.com wrote:
>You said earlier you do not want to use a form to propagate information. Now you suggest to use a form to do excactly that.

The problem is that most of the navigation by the user will be via
links. I could of course imbed the variables in the URL but I would
prefer not to send some of that information 'in the clear'. Ideally, I
would like to send them along as a post request, but I don't see how
this is possible without using forms.
Us a form method=post and make the URLS and onclick=submit() type
javascript function.

You can have a separat javascript function set up wahetver cvariable you
like depending on waht is clicked.

Mind you, I simply use URLS and get variables mainly as they are a
convenience to the user, not an absolute restriction.

If they try to access things outside the scope of whats allowed, they
get a rude message back: thats pure data validatin on teh get variables.
\
Jun 2 '08 #10
Jerry Stuckle wrote:
se************@gmail.com wrote:
>>You said earlier you do not want to use a form to propagate
information. Now you suggest to use a form to do excactly that.

The problem is that most of the navigation by the user will be via
links. I could of course imbed the variables in the URL but I would
prefer not to send some of that information 'in the clear'. Ideally, I
would like to send them along as a post request, but I don't see how
this is possible without using forms.

It's not.

As Erwin said - use sessions.
Which tend to use cookies or GET variables to maintain state anyway.
Jun 2 '08 #11
The Natural Philosopher wrote:
Jerry Stuckle wrote:
>se************@gmail.com wrote:
>>>You said earlier you do not want to use a form to propagate
information. Now you suggest to use a form to do excactly that.

The problem is that most of the navigation by the user will be via
links. I could of course imbed the variables in the URL but I would
prefer not to send some of that information 'in the clear'. Ideally, I
would like to send them along as a post request, but I don't see how
this is possible without using forms.

It's not.

As Erwin said - use sessions.
Which tend to use cookies or GET variables to maintain state anyway.
Ah, I see you're showing your (lack of) intelligence again with another
stoopid comment from you. Read the whole thread, not just a couple of
posts.

Yes, PHP uses cookies or, if cookies are disabled, can use a GET
variable. But that is only for the session id, not for the actual data.
And by using a cookie, the session id doesn't need to be sent in the
GET string - which is what the op is trying to avoid.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Jun 2 '08 #12
The Natural Philosopher schreef:
se************@gmail.com wrote:
>>You said earlier you do not want to use a form to propagate
information. Now you suggest to use a form to do excactly that.

The problem is that most of the navigation by the user will be via
links. I could of course imbed the variables in the URL but I would
prefer not to send some of that information 'in the clear'. Ideally, I
would like to send them along as a post request, but I don't see how
this is possible without using forms.

Us a form method=post and make the URLS and onclick=submit() type
javascript function.

You can have a separat javascript function set up wahetver cvariable you
like depending on waht is clicked.

Mind you, I simply use URLS and get variables mainly as they are a
convenience to the user, not an absolute restriction.

If they try to access things outside the scope of whats allowed, they
get a rude message back: thats pure data validatin on teh get variables.
\
I don't think this is general good advise.
This method is based on JavaScript, which isn't always available.
Session are much easier, and do not depend on JavaScript.

PHP even helps, if configured that way, to add the phpsessionid to
cookie, formelements (as hidden), or url encoded in the url.
No need to do this yourself.

Sebastian, just have a look at how sessions work.
If you are on PHP version >4 (and who uses 3 in these days?) then
sessionsupport is easy and reliable.
You can even use the autostart session simply by editting your php.ini.
Read more here:
http://nl2.php.net/manual/en/session...ion.auto-start
Regards,
Erwin Moller
Jun 2 '08 #13
Jerry Stuckle wrote:
The Natural Philosopher wrote:
>Jerry Stuckle wrote:
>>se************@gmail.com wrote:
You said earlier you do not want to use a form to propagate
information. Now you suggest to use a form to do excactly that.

The problem is that most of the navigation by the user will be via
links. I could of course imbed the variables in the URL but I would
prefer not to send some of that information 'in the clear'. Ideally, I
would like to send them along as a post request, but I don't see how
this is possible without using forms.
It's not.

As Erwin said - use sessions.
Which tend to use cookies or GET variables to maintain state anyway.

Ah, I see you're showing your (lack of) intelligence again with another
stoopid comment from you. Read the whole thread, not just a couple of
posts.

Yes, PHP uses cookies or, if cookies are disabled, can use a GET
variable. But that is only for the session id, not for the actual data.
And by using a cookie, the session id doesn't need to be sent in the
GET string - which is what the op is trying to avoid.
It's not clear as to what his real issue actually is.

The original post said maintaining a state without use of post get or
cookie variables.

Saying 'then use sessions' masks the fact that sessions indeed use
cookies, post or get variables to maintain states.
Jun 2 '08 #14
The Natural Philosopher wrote:
Jerry Stuckle wrote:
>The Natural Philosopher wrote:
>>Jerry Stuckle wrote:
se************@gmail.com wrote:
>You said earlier you do not want to use a form to propagate
>information. Now you suggest to use a form to do excactly that.
>
The problem is that most of the navigation by the user will be via
links. I could of course imbed the variables in the URL but I would
prefer not to send some of that information 'in the clear'. Ideally, I
would like to send them along as a post request, but I don't see how
this is possible without using forms.
>

It's not.

As Erwin said - use sessions.

Which tend to use cookies or GET variables to maintain state anyway.

Ah, I see you're showing your (lack of) intelligence again with
another stoopid comment from you. Read the whole thread, not just a
couple of posts.

Yes, PHP uses cookies or, if cookies are disabled, can use a GET
variable. But that is only for the session id, not for the actual
data. And by using a cookie, the session id doesn't need to be sent
in the GET string - which is what the op is trying to avoid.
It's not clear as to what his real issue actually is.

The original post said maintaining a state without use of post get or
cookie variables.

Saying 'then use sessions' masks the fact that sessions indeed use
cookies, post or get variables to maintain states.
It looked to me he wanted to avoid using a form because he's using links
instead. He didn't want to put the data in the GET url, which is
understandable. And he didn't want to save the data in a cookie.

You have to use (at least) one of the three to pass information. But
you don't have to hold the data in the cookie - you can use the session
for that and only pass the session id in the cookie.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Jun 2 '08 #15
>Us a form method=post and make the URLS and onclick=submit() type
javascript function.

As Moller pointed out, Javascript isn't always available, and if it is
indeed disabled the application becomes essentially useless! At any
rate, sessions turned out to be exactly what I needed. Thank you all
for your help.
Jun 2 '08 #16
se************@gmail.com schreef:
>>Us a form method=post and make the URLS and onclick=submit() type
javascript function.

As Moller pointed out, Javascript isn't always available, and if it is
indeed disabled the application becomes essentially useless! At any
rate, sessions turned out to be exactly what I needed. Thank you all
for your help.
Good choiche.
Session are really extremely handy.
Once you know your way around with session, you won't look back at other
options. ;-)

Good luck.

Regards,
Erwin Moller
Jun 2 '08 #17

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

Similar topics

6
by: Mark Carter | last post by:
I had a play with XML-RPC the other day, and it seemed really simple to use; which really made an impression on me. But you can't make data persist on the server (not without rolling your own...
2
by: Citoyen du Monde | last post by:
Trying to get some ideas on a simple javascript project (to teach myself the language). I want to develop a client-side vocabulary practice application that would allow users to enter their own...
3
by: Marc Gravell | last post by:
Kind of an open question on best-practice for smart-client design. I'd really appreciate anyones views (preferably with reasoning, but I'll take what I get...). Or if anybody has any useful links...
7
by: Steve Mauldin | last post by:
I have a public variable that is declared in a public module. This Variable is stored into a Session variable and used to pass data from page to page. I am seeing on my local development box that...
11
by: mwt | last post by:
Hi. I'm reworking a little app I wrote, in order to separate the data from the UI. As a start, I wanted to create a iron-clad data recepticle that will hold all the important values, and stand up...
22
by: Zytan | last post by:
I have public methods in a form. The main form calls them, to update that form's display. This form is like a real-time view of data that is changing. But, the form may not exist (it is...
19
Atli
by: Atli | last post by:
Introduction At some point, all web developers will need to collect data from their users. In a dynamic web page, everything revolves around the users input, so knowing how to ask for and collect...
4
by: coldpizza | last post by:
Hi, I want to run a database query and then display the first 10 records on a web page. Then I want to be able to click the 'Next' link on the page to show the next 10 records, and so on. My...
6
by: mirandacascade | last post by:
Assume the following: 1) multi-user environment 2) when user opens app, want to run some code that retrieves some information specific to the user...retrieving this information is somewhat i/o...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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?

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.