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!
by looking at your example, you want the contents of $fname in your session variable. The way that it is in your example works because $fname has been given a value, then is passing it on to the session variable, the other way will not work because there is no data within the session variable at the time to give its data to $fname.
If you wanted to get the session variable data on a separate page, after the first example has been run, then you could use the second example to put your session data into the $fname variable