Show/Hide PHP & javascript?

Status
Niet open voor verdere reacties.

ready2go

Gebruiker
Lid geworden
29 mrt 2010
Berichten
12
Heey,

Ik ben druk bezig met een profielpagina, wat aardig lukt. Ik heb een ledenlijstpagina met wat hoofdinformatie. Nu wil ik graag dat als je op een van de leden klikt dat hij overige, gedetailleerde informatie toont. In javascript kan ik dit best doen:

HTML:
<p id="hidingtext">Hoi</p>
<A HREF="javascript:myfunction()">Click Here</A> 
<script type="text/javascript">
document.getElementById('hidingtext').style.visibility = 'hidden';
function myfunction()
{
var e = document.getElementById('hidingtext');
  if(e.style.visibility == 'hidden') e.style.visibility = 'visible';
  else e.style.visibility = 'hidden'
}
</script>

Nu zou ik dat dus willen toepassen op de volgende pagina:

HTML:
<?
include("config.php");
?> 
<html>

<head>
    <title>Ledenlijst</title>
    <link rel="stylesheet" type="text/css" href="style.css">
</head>

<body>
    <p><b>De Ledenlijst</b></p>
    <table border="0" cellpadding="1" cellspacing="0" width="70%">
        <tr>
            <td>Username</td>
            <td>Rank</td>
		<td>Kills</td>
				<td>Deaths</td>
		<td>K/d</td>
		<td>Level</td>
		<td>Prestige</td>
		<td>Userinfo</td>
		<td>Killstreak</td>
        </tr>
        <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
			<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
        </tr>
        <?
            $query = mysql_query("SELECT * FROM `inlogsysteem`");

            while($rij = mysql_fetch_assoc($query))
            {
                echo "
                <tr>
                    <td>".ucfirst($rij['username'])."</td>
                    <td>";
                    if($rij['status'] == "a") { echo "<span style=\"color:#F00000;\"><b>Admin</b></span>"; }
                    if($rij['status'] == "m") { echo "<span style=\"color:#102030;\"><b>Clanleader</b></span>"; }
                    if($rij['status'] == "n") { echo "Clanmember"; }
                echo "</td>
                   <td>".$rij['kills']."</td>
				   <td>".$rij['deaths']."</td>
				   <td>".round($rij['kills']/$rij['deaths'],2)."</td>
				   <td>".$rij['level']."</td>";
				   if($rij['prestige']>0) {echo "<td> <img src='http://forums.modernwarfare247.com/public/style_extra/reputation_icons/mw2/prestige-".$rij['prestige'].".png' width='24' height='24'></td>";}
				   else{echo "<td> <img src='http://forums.modernwarfare247.com/public/style_extra/team_icons/ranks-mw2/22-commander.png' width='24' height='24'></td>";}
				  echo "<td>".$rij['motto']."</td>";
				  
				  if($rij['kw0']==0) { echo "<td> <img src='http://images1.wikia.nocookie.net/__cb20091221042521/callofduty/images/5/5d/UAV.jpg' width='24' height='24'>  </td>";}
				  if($rij['kw0']==1) { echo "<td> <img src='http://images3.wikia.nocookie.net/__cb20100129011205/callofduty/images/2/24/Carepackageicon.png' width='24' height='24'> </td>";}
				  if($rij['kw0']==2) { echo "<td> <img src='http://images2.wikia.nocookie.net/__cb20100129011303/callofduty/images/c/cd/CounterUAV_icon.PNG' width='24' height='24'> </td>";}
				  if($rij['kw0']==3) { echo "<td> <img src='http://images2.wikia.nocookie.net/__cb20091221042521/callofduty/images/5/5e/Sentry-Gun.jpg' width='24' height='24'> </td>";}
				  if($rij['kw0']==4) { echo "<td> <img src='http://images3.wikia.nocookie.net/__cb20091221042520/callofduty/images/4/43/Predator-Missile.jpg' width='24' height='24'>  </td>";}
				  if($rij['kw0']==5) { echo "<td> <img src='http://images3.wikia.nocookie.net/__cb20100129011759/callofduty/images/d/de/PrecisionAirstrike_icon.PNG' width='24' height='24'> </td>";}
				  if($rij['kw0']==6) { echo "<td> <img src='http://images2.wikia.nocookie.net/__cb20100129011526/callofduty/images/c/cf/Harrier_Icon.png' width='24' height='24'> </td>";}
				  if($rij['kw0']==7) { echo "<td> <img src='http://images2.wikia.nocookie.net/__cb20100129011614/callofduty/images/3/33/AttackHelicopter_Icon.png' width='24' height='24'> </td>";}
				  if($rij['kw0']==8) { echo "<td> <img src='http://images2.wikia.nocookie.net/__cb20100129011651/callofduty/images/1/1f/EmergancyAirdrop_Icon.png' width='24' height='24'>  </td>";}
				  if($rij['kw0']==9) { echo "<td> <img src='http://images1.wikia.nocookie.net/__cb20100129011819/callofduty/images/7/7c/PaveLow_icon.PNG' width='24' height='24'> </td>";}
				  if($rij['kw0']==10) { echo "<td> <img src='http://images2.wikia.nocookie.net/__cb20100129011914/callofduty/images/f/f2/StealthBomber_Icon.png' width='24' height='24'> </td>";}
				  if($rij['kw0']==11) { echo "<td> <img src='http://images3.wikia.nocookie.net/__cb20100129011943/callofduty/images/4/4b/ChopperGunner_Icon.png' width='24' height='24'> </td>";}
				  if($rij['kw0']==12) { echo "<td> <img src='http://media.giantbomb.com/uploads/2/23286/1132575-3879162019_0ec5338d0a_o_icon.png' width='24' height='24'>  </td>";}
				  if($rij['kw0']==13) { echo "<td> <img src='http://images4.wikia.nocookie.net/__cb20100129010355/callofduty/images/b/b3/EMP_Icon.png' width='24' height='24'> </td>";}
				  if($rij['kw0']==14) { echo "<td> <img src='http://images3.wikia.nocookie.net/__cb20100326005346/callofduty/images/2/2b/NukeIcon.png' width='24' height='24'> </td>";}
				echo"
				</tr>";
            }
        ?>
    </table>
</body>

</html>
Echter heb ik geen idee waar ik moet beginnen en vraag ik me ook af of het misschien overzichtelijker wordt als ik bijvoorbeeld een aparte pagina maak ipv zo'n script (denk aan: ledenlijst.php?id=4)
Iemand die deze scripts kan samenvoegen, andere ideeën heeft o.i.d. ik hoor het graag.

Het bovenstaande script is werkend te zien op: ready2go.byethost18.com/ledenlijst.php

Alvast bedankt
 
ruikt naar ajax weet dat je dit beter niet meer ondersteund, als er geld is beter serverkopen
en pagina volledig opbouwen anders heb je te veel te controleren wat hij well of niet kan mag zien


Ik persoonlijk zou iedereen een private page en/of publieke page geven waar alles op staat en daar naar linken
 
Status
Niet open voor verdere reacties.

Nieuwste berichten

Terug
Bovenaan Onderaan