rvanness wrote:I enclose all of the PHP code within a pair of {} braces because that is the way my teacher taught me.
Interesting. You might ask your teacher why this is so, and why you shouldn't include 2, 3, or even 342 {} braces around all of the PHP code, since they essentially have no effect other than to add to the confusion of matching up a { with its associated }. :p
rvanness wrote:my captcha says to do that
Well in that case, you should tell the authors of the documentation that they aren't very careful in writing thorough documentation.
Too many times, documentation intends to scare end users into thinking that if session_start() isn't on the very absolute 1st line of their code then everything will break, your wife will leave you, and God will aim a lightning bolt at you. Okay, maybe they don't all say that, but it sure seems like it.
The only thing you need to do is make sure that [man]session_start/man (and any other function that modifies the HTTP headers, such as [man]header/man) is called before any output. The reason I chided the authors of the documentation you referenced is that they failed to mention the fact that the line break after the closing '?>' on that first line is output, meaning HTTP headers are then sent after line #1 (which means you can't call [man]header/man or similar functions on lines 2 through the end of your code).
Long story short: get rid of the closing '?>' on the first line (and the opening '<?php' on the next, of course). [man]session_start/man does not have to be on the first line of a PHP script, nor should you open and close PHP tags unless you actually mean to insert plain text data at that point.