FireFox! The PHP Forum Loans and Credit
Panama Web Design for Hire Free Insurance Quotes!
Web Hosting Advertise Here $10 a Month Designer Children
Never Pay Taxes Again HGH Domain name registration
Web Hosting and Dedicated Servers Insurance Affordable web-hosting


HomeWatched TopicsRegisterSearchDirectory
FAQMemberlistUsergroupsLog inStoresItemsBank
Google

Reply to topic Page 1 of 1
PHP Variable
Message  

Reply with quote
Post PHP Variable 
Hey Smile

Im New to this PHP forum site I'm really excited, as I been learning PHP and it's been a  mission on my own, I hope this forum and it's users will help me thru this journey.

I created a database and a form that the user has to enter his/her name and password the

PHP form works great I'm trying to display which user has entered on the title bar, I found a way by:

Code:

Print "<title>User:".$_SESSION['user']."</title>";


It works but the problem is I dont want "User:" to be displayed in the title bar when a user didn't login.

It might sound silly but I would really appreciate help with this.

Thanks

View user's profile Send private message

Reply with quote
Post  
If you replace that code with this code, then it should remove the User: text:

Code:
if ($_SESSION['user'] != "") {
  Print "<title>User:".$_SESSION['user']."</title>";
}
else {
  Print "<title>Please Log In</title>";
}


You can change the second print to what you want it to say when they haven't logged in (change where it says "Please Log In").

Have fun!

~ ChipChamp

View user's profile Send private message Visit poster's website

Reply with quote
Post  
Code:

if ($_SESSION['user'] != "")
  Print "<title>User:".$_SESSION['user']."</title>";
else
  Print "<title>Please Log In</title>";

i think it better.


_________________
Thank !
Php Tutorials Collection
View user's profile Send private message

Reply with quote
Post  
Hey guys thanks for the help it works great.

Only problem i'm having is that when the user logs in it doesn't show in title bar only after I

click on the Refresh button or Reload the page does it come up.

There are ways that i found to refresh the page but it doesn't work the way i want it to  Sad  some code keeps on refrehing like the meta refresh and others is there some other way of refreshing it onload to show ?

Thanks again for the help.

View user's profile Send private message

Reply with quote
Post  
The only thing that I can think of is to make sure that your code where it sets the $_SESSION['user'] is BEFORE the codes that we posted above.

View user's profile Send private message Visit poster's website

Reply with quote
Post  
Thanks ChipChamp

I tried that it doesn't work I still got to refresh the page  Sad  this is how I got the code:

Code:


        if ($_SESSION['user'] != "") {
        $useron="User: ".$_SESSION['user']." on Spree - Content Management System";
        }
        else {
        $useron="Reload Page";
       }
      
      Print "<html>"."\r\n";
      Print "<head>"."\r\n";      
      Print "<title>".$useron."</title>";      
      Print "</head>"."\r\n";



View user's profile Send private message
Display posts from previous:
Reply to topic Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
  



Google

FireFox! The PHP Forum Loans and Credit
Panama Web Design for Hire Free Insurance Quotes!
Web Hosting Advertise Here $10 a Month Designer Children
Never Pay Taxes Again HGH Domain name registration
Web Hosting and Dedicated Servers Insurance Affordable web-hosting


Web Design by PlatinumShore.com & Web Hosting by TradeWebHosting.com