Look i have been reading all your code and the problem is always have a session realm start on top of your file before any code. That includes html too.

session_start();

just declare a simple session start in its owm php tag up there. ON THE FIRST LINE WITHOUT A SPACE.

later you can set a session variable .

Also try not to use session variable raw like..

echo $_SESSION['username']

dont keep to that.

always put it in a standard variable. eg..

if($_POST){
$_SESSION['name']=$_POST['name'];
//dont forget to trim,strip_tags, etc.. clean always inputs that you receives even if it come from heaven. angels sometimes get lazy. trust no inputs.
}
// refer to session variable and put it in normal variable for use.
$foo=$_SESSION['name'];
echo $foo;

This way you don't need a form for the end user to fill out and you could just use whatever formula you were previously using to set the variable. If you don't want the end user to be able to see the variable and it's value or be able to manually change it then this is not advisable because anyone could just go to the address bar and change the value of each variable this way.

My apologies for taking this off topic for a second. But this comment struck my interest.

TheSecOrg
Also try not to use session variable raw like..

echo $_SESSION['username']

dont keep to that.

always put it in a standard variable. eg..

if($_POST){
$_SESSION['name']=$_POST['name'];
//dont forget to trim,strip_tags, etc.. clean always inputs that you receives even if it come from heaven. angels sometimes get lazy. trust no inputs.
}
// refer to session variable and put it in normal variable for use.
$foo=$_SESSION['name'];
echo $foo;

you get the idea?

:) Explore.

-evstevemd
-richieking

I was reading through this thread and saw this comment and having never heard this before had to do some research. Richieking is absolutely right in terms of setting a global to a local variable being faster to echo out. But, it is only nominally faster and I saw consistent results up over 100,000 echos.

I benchmarked this at 100 cycles of echoing a variable 1000 times:

First result is echoing the $_SESSION value directly.
Second result is echoing $var after $var = $_SESSION.
Third result was setting it to an array item instead of a variable. (Just out of curiosity)

My apologies for taking this off topic for a second. But this comment struck my interest.

-evstevemd
-richieking

I was reading through this thread and saw this comment and having never heard this before had to do some research. Richieking is absolutely right in terms of setting a global to a local variable being faster to echo out. But, it is only nominally faster and I saw consistent results up over 100,000 echos.

I benchmarked this at 100 cycles of echoing a variable 1000 times:

First result is echoing the $_SESSION value directly.
Second result is echoing $var after $var = $_SESSION.
Third result was setting it to an array item instead of a variable. (Just out of curiosity)

I wouldn't put to much focus on it, you'd have to be echoing millions of session variables for it to even begin to make an impact. Spend the time optimizing the more bottleneck prone areas of your code, you'll see a much bigger return.

I wouldn't put to much focus on it, you'd have to be echoing millions of session variables for it to even begin to make an impact. Spend the time optimizing the more bottleneck prone areas of your code, you'll see a much bigger return.

look i tried to help you, the best you did was to flag me bad post because of basic platform i asked you.

mmm ;)

?! I didnt flag your post as bad! I'm sorry but I really didnt! I pressed Post Reply then my browser said I wasn't connected to the internet =.=, I really didnt flag your post but if I did for whatever reason I didnt mean it!