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?
Using a parameter as a static type
Moderator: General Moderators
-
mustafamisir
- Forum Newbie
- Posts: 23
- Joined: Wed Jun 22, 2005 1:00 pm
- Contact:
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.
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'];
?>