Link to home
Start Free TrialLog in
Avatar of helpchrisplz
helpchrisplz

asked on

puting echo into a variable

learning php :)
this is probably really easy to do but am stuck and running out of coffee
i currently have this block of code :

if ($name==$dbusername&&$password==$dbpassword)
      {
            
      
      $_SESSION['UserName']=$name;
      if ($_SESSION['UserName'])
echo "Welcome to the scapp gaming network, ".$_SESSION['UserName'];
      
      
      }
      else
      echo "password incorrect!";
}


i would like to position my echos on the page. it currently outputs the echo to the top of the page
and moves the navigation down
how can i echo this where i want it?
thx
ASKER CERTIFIED SOLUTION
Avatar of Lukasz Chmielewski
Lukasz Chmielewski
Flag of Poland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
And   if ($_SESSION['UserName']) - this should be
 if (!empty($_SESSION['UserName'])) - you are checking if the SESSION array has the UserName variable set.