VeggieBoards banner
1 - 6 of 6 Posts

·
Registered
Joined
·
1,182 Posts
Information sent to a PHP script is only available to that script at the time you ran it unless you store it somewhere. I recommend looking into cookies and sessions.

~Wonder
 

·
Registered
Joined
·
1,182 Posts
That's the get method, and yes, use an & between variables. Be careful you don't put store sensitive information such as passwords in the query. Search engines, among other things, have a tendency to find out.

~Wonder
 

·
Registered
Joined
·
1,182 Posts
Sessions store the info on the server in temp files and store a cookie with the session id on the client computer or passes the session id as a variable in the URL if cookies are not available. If you want to store the data on the client computer, then use cookies. But you don't need MySQL for this task. If you check out session on the PHP website, they should tell you everything you need to know.

HTH,

~Wonder
 

·
Registered
Joined
·
1,182 Posts
According to the description of what you want to do, then you need to "preserve data across subsequent accesses". PHP is not an interactive language that you can pause and wait for user input. All a PHP script can do is accept data and return output. It doesn't remember previous things, which is why you have to tell the script everything it needs to know at runtime. You can do this in a couple of ways.

1. Get/Post methods

2. Cookies

3. Sessions

4. External database

The easiest way to preserve data across subsequent accesses is cookies or the Get/Post methods, depending upon what needs to be inputted. Even VB, which is PHP based, stores login/password data in the cookie. Check it out, put this into your address bar:

javascript:alert(document.cookie.split(";").join(" \
"))

HTH,

~Wonder
 

·
Registered
Joined
·
1,182 Posts
Quote:
Originally Posted by soilman View Post

Veggieboards naturally uses cookies because it has to recognize registered users. It serves one user with a different page than the next. It naturally uses sessions because it has to know whether any particular user logged in 5 minutes ago, or 5 hours ago. My application is entirely different. 1. It is several levels of complication less complicated. 2. There is no reason that it needs to discriminate between users, or know anything about the user whatsoever. It just needs to do some calculations, and store them in a single array.
The concept is still the same. Your application needs to record information specific to a single user. It needs to discriminate between someone who chose 5 onions and someone who chose 3 so it can give them the required information.

Your program sounds like it could benefit from a multidimensional named array.

Example:

$myArray=array(

"onions"=>array(10,20,30,40,50),

"bananas"=>array(9,8,7,6,5,4),

"tj"=>"Tastes like pennies"

);

No matter who your transfer information, PHP will still have to load the arrays at runtime. It's best to define them in the script instead of transferring them via GET.

HTH,

~Wonder
 
1 - 6 of 6 Posts
Top