Solved

puting echo into a variable

Posted on 2011-03-05
2
278 Views
Last Modified: 2012-05-11
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
0
Comment
Question by:helpchrisplz
  • 2
2 Comments
 
LVL 27

Accepted Solution

by:
Lukasz Chmielewski earned 500 total points
ID: 35042583
You just put this into the place where you want:
<?php
 if ($_SESSION['UserName'])
echo "Welcome to the scapp gaming network, ".$_SESSION['UserName'];
?>
0
 
LVL 27

Expert Comment

by:Lukasz Chmielewski
ID: 35042611
And   if ($_SESSION['UserName']) - this should be
 if (!empty($_SESSION['UserName'])) - you are checking if the SESSION array has the UserName variable set.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question