August 7th, 2013, 07:03 AM
How to render different button base on condition?
I have a question is how to create a button base on status. let say if not login, the button will direct to the login page, if not, the button will direct to the logout page. May i know how to do this in php? I hv the codes as below..
$LoginStatus = False;
$LoginStatus = True;
$loginname = "Guest";
August 7th, 2013, 07:57 AM
Please enclose your code in [ PHP ] tags. See the sticky at the top of this forum that says READ THIS BEFORE POSTING.
What have you tried and what is not working the way you want?
There are 10 kinds of people in the world. Those that understand binary and those that don't.
August 7th, 2013, 08:32 AM
You shouldn't be relying on button values for logged in/out status. Any page which requires a login should check to see if the current user is logged in. If they're not, that page should redirect to a login page.
HEY! YOU! Read the New User Guide and Forum Rules
"They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin
"The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002
Think we're being rude? Maybe you asked a bad question
or you're a Help Vampire.
Trying to argue intelligently? Please read this.