Jump to content

All Of A Sudden Stopped Working?


kirbyweb

Recommended Posts

As people mentioned earlier, you cannot output any content before session_start(). Not even an empty space or a line break.session_start() has to be practically the first thing on the page, before any HTML, before any text and before any echo statements. Make sure there you don't leave any spaces or line breaks before the opening <?php block.

Link to comment
Share on other sites

Is it because I am basicly saying if the button was pressed once? then when I go to another page it goes away?
OK, the reason that it only displays the name when the form is submit is because you have that echo statement within the if() condition that checks for the form value.Remove this line:
echo 'Welcome ' .$row["username"] .'.';

And add this after all the rest of the PHP, outside of any other if() blocks

  if(isset($_SESSION['username'])) {	// If the username has been stored in a session variable	echo 'Welcome ' . $_SESSION['username'] . '.';  }

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...