php and html

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
highjo
Forum Contributor
Posts: 118
Joined: Tue Oct 24, 2006 1:07 pm

php and html

Post by highjo »

Hello guys! i really don't know if this topic was discussed before but i haven't got any rsult from the search.I'm tring to build a control panel which will be use by differents persons gategorised by thier group id in the database.ok.In the panel i created all the tool links necessary to manage the site.But then i entend t hide some links that some people with low privilige shouldn't see.
here is my codes

Code: Select all

 
 
<?php
 if ($_SESSION['MM_UserGroup']==2) {
    
 
        echo "<script language='javascript'>";
        echo "document.getElementById('createarticle').style.display='none'; ";
        echo "document.getElementById('articlesindex').style.visibility='hidden'; ";
        echo "document.getElementById('valider').style.visibility='hidden'; ";
        echo "document.getElementById('corbeille').style.visibility='hidden'; ";
        echo "document.getElementById('configglobale').style.visibility='hidden'; ";
        echo    "</script>";
            
 }
?>
 
i named the div tag by id but nothing is happenning for people of group id 2.If there is a better idea please let me know or help me make this work please. thanks
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: php and html

Post by Christopher »

Probably better than hiding the divs would be to only add them to the page by putting if()'s around the HTML.

It this Javascript in the body or head of the document?
(#10850)
User avatar
highjo
Forum Contributor
Posts: 118
Joined: Tue Oct 24, 2006 1:07 pm

Re: php and html

Post by highjo »

I put the javascript first in the head but realising it's not working i put it finally on th first line of the body.
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Re: php and html

Post by Ollie Saunders »

Probably better than hiding the divs would be to only add them to the page by putting if()'s around the HTML.
Agreed.
Post Reply