Using a parameter as a static type

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mustafamisir
Forum Newbie
Posts: 23
Joined: Wed Jun 22, 2005 1:00 pm
Contact:

Using a parameter as a static type

Post by mustafamisir »

Hi,

I am trying to use a parameter in a static way. I use a parameter "str", and when I call the page I add some value to this string. But, when I call the page each time, "str"s value is "0", but I must add some data continuosly without being empty the value of "str" and when I press an information button, I must take the value of it.

How I can solve it?
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

PHP doesn't support static variables like that. You'll need to do one of several different options:

1. Write the variable to the page in a form element.

2. Put the variable into a session.

3. Save the variable into a file.

4. Save the variable into a database.

Any of them will work. Using a session is probably the easiest and quickest method.

Code: Select all

<php

session_start();

$_SESSION['mystring'] .= "More text";

echo $_SESSION['mystring'];

?>
Post Reply