html/php code help

Place for questions and answers for all newcomers and new coders. This is a free for all forum, no question is too stupid and to noob.
Post Reply
kierongi
Posts: 30
Joined: Mon Aug 12, 2013 9:57 pm

html/php code help

Post by kierongi »

hey guys been a while how is things?


i am having a little trouble with some coding

what i am trying to do is hide a button (which is for people to log in) when they are logged in so they cannot see this

here is my current banner

Image

on this page i am currently logged in and due to this i want the log-in and register to disappear and when i am not logged in i want the log-out to disappear

hope i have explained it ok

Thank you

Kieron
User avatar
hallsofvallhalla
Site Admin
Posts: 12023
Joined: Wed Apr 22, 2009 11:29 pm

Re: html/php code help

Post by hallsofvallhalla »

several ways of doing this. quick and dirty way is to check for session id and if it does not exist then add code in PHP or javascript to add it

quick pseudo code

Code: Select all

<?php
if(!$isset($_Session['Id']))
{
echo "<a href='/logon.php' ><img src='/images/logonButton.png' ></a>";
}
kierongi
Posts: 30
Joined: Mon Aug 12, 2013 9:57 pm

Re: html/php code help

Post by kierongi »

thanks for the quick reply Halls

how would i create a session start ID

Thanks

EDIT: thanks for the help managed to do what i wanted with your help
Post Reply

Return to “Beginner Help and Support”