Page 1 of 1

Using a parameter as a static type

Posted: Thu Jul 14, 2005 4:25 am
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?

Posted: Thu Jul 14, 2005 4:56 am
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'];

?>