Page 1 of 1

Table with a drop down GET function[done]

Posted: Thu Dec 13, 2007 9:33 am
by SirChick
I have a table where by i want to click on a row and it will display that row's contents under it but also be in between the other rows that the table has.

My idea has worked how ever i cannot get the html to be "between" the rows.. it keeps being echo'd above the table...

this is what i got :

Code: Select all

<?
$GetReports = mysql_query("SELECT * FROM reportedusers WHERE StaffRead='{$_SESSION['Current_User']}'")
or die(mysql_error());
	If(mysql_num_rows($GetReports) < 1){
?>
		<div id="bv_" style="position:absolute;left:303px;top:264px;width:92px;height:48px;z-index:2" align="center">
		<font style="font-size:13px" color="#FFFFFF" face="Arial">There are no reports assigned to you!<br></div>
<?
}Else{
?>
		<div id="bv_" style="position:absolute;left:160px;top:350px;width:150px;height:22px;z-index:1" align="center">
		<table width="600" border="1" cellpadding="0" cellspacing="0">
			<tr>
				<td width="200"><font style="font-size:14px" color="#FFFFFF" face="Arial"><center><b><u>User:</center></b></u></font></td>
				<td width="200"><font style="font-size:14px" color="#FFFFFF" face="Arial"><center><b><u>Report ID:</center></b></u></font></td>
		</tr>
<?
	while($row = mysql_fetch_assoc($GetReports)){
		$RecordID = $row['RecordID'];
		$Info = $row['Log'];
		$ReportedPlayer = $row['ReportedPlayer'];
		$GetUserName = mysql_query("SELECT * FROM userregistration WHERE UserID='$ReportedPlayer'")
			or die(mysql_error());
		$UserNameRow = mysql_fetch_assoc($GetUserName);
		$ReportedPlayer = $UserNameRow['Username'];
?>
	<tr>
		<td width="100"><center><font style="font-size:14px" color="#FFFFFF" face="Arial"><?=$ReportedPlayer?></center></font></td>
		<td width="100"><center><font style="font-size:14px" color="#FFFFFF" face="Arial"><a href="pendingreports.php?view=<?=$RecordID?>" style="color:#FFFFFF">View</a></center></font></td>
	</tr>
<?
			If(isset($_GET['view'])){
?>
					<font style="font-size:13px" color="#FFFFFF" face="Arial">UserID: <?=$UserID?><br>
						UserName: <?=$UserName?><br>
						Money: <?=$Money?><br>
						<br>
					<a href="viewuerslogs.php?logs=<?=$UserID?>" style="color:#FFFFFFF">View users logs</a><br>
					<a href="viewusersmessages.php?messages=<?=$UserID?>" style="color:#FFFFFF">View users messages</a><br>
					<a href="Viewusersonsameip.php?ip=<?=$UserID?>" style="color:#FFFFFF">View users on same IP</a></font></div>
					<b><u>Player Report Infomation:</u></b><?=$Info?> 
					<a href="closereport.php?report=<?=$RecordID?>" style="color:#FFFFFF">No Evidence</a><br>
				<br>
					<a href="secondopinion.php?report=<?=$RecordID?>" style="color:#FFFFFF">Get Second Opinion</a><br>
				<br>
					<a href="punishment.php?report=<?=$RecordID?>" style="color:#FFFFFF">Guilty</a></u></b></font></div>
<?
					}
			}
	}
?>

Posted: Thu Dec 13, 2007 9:45 am
by John Cartwright
You might want to try and format the code (indenting). I for one can't be bothered to attempt to read it, otherwise I'd be happy to help :).

Posted: Thu Dec 13, 2007 9:48 am
by SirChick
It was but it stretched the forum out loads so i had squash it in.

I can space it out downwards how ever can't really go sideways much more

Posted: Thu Dec 13, 2007 10:00 am
by John Cartwright
Stretching is fine. Readability is most important.

Posted: Thu Dec 13, 2007 10:04 am
by SirChick
Ok edited the original post.. its indented.. or was.. but it wraps to the next line so kinda makes it look messy again =/

Basically the html echo'd here:

If(isset($_GET['view'])){
// html


Is being echoed above the entire table rather than being under the row the user wanted to view and above the other rows that are usually next.

Its kinda like making a collapsible drop down thing how ever not javascript because people kept turning javascript off.

Posted: Thu Dec 13, 2007 10:13 am
by John Cartwright

Code: Select all

?>
   <tr>
      <td width="100"><center><font style="font-size:14px" color="#FFFFFF" face="Arial"><?=$ReportedPlayer?></center></font></td>
      <td width="100"><center><font style="font-size:14px" color="#FFFFFF" face="Arial"><a href="pendingreports.php?view=<?=$RecordID?>" style="color:#FFFFFF">View</a></center></font></td>
   </tr>
<?
         If(isset($_GET['view'])){
?>
Look carefully at your html formatting. You are closing the row before it gets to the isset()

Posted: Thu Dec 13, 2007 10:21 am
by SirChick
Jcart wrote:

Code: Select all

?>
   <tr>
      <td width="100"><center><font style="font-size:14px" color="#FFFFFF" face="Arial"><?=$ReportedPlayer?></center></font></td>
      <td width="100"><center><font style="font-size:14px" color="#FFFFFF" face="Arial"><a href="pendingreports.php?view=<?=$RecordID?>" style="color:#FFFFFF">View</a></center></font></td>
   </tr>
<?
         If(isset($_GET['view'])){
?>
Look carefully at your html formatting. You are closing the row before it gets to the isset()
I think this is what you meant....I put the </tr> after the If(isset($_GET['view'])){ // stuff } but still echoed above the table.. :(

Posted: Thu Dec 13, 2007 10:23 am
by John Cartwright
You really need to learn the basic html principles.

<tr> is a row
<td> is a column

All your html being outputting in your script is not within a column.

So it will look like

Code: Select all

<tr>
   <td> </td>
   <td> </td>
 
   //your stuff is going here, it is not in a column so it will look screwy
</tr>

Posted: Thu Dec 13, 2007 10:33 am
by SirChick
Well you mentioned row in your one post then columns in your next.. so kinda got me confused.

But i think my concept is possibly over complex and is going to give me more headaches than needed so I think I'll opt out to a different design that im familiar with :P

Was worth my trying though hehe.

Thanks for being so patient with me! :)

Posted: Thu Dec 13, 2007 11:18 am
by John Cartwright
Well rows contain columns, so one would assume that you'd need to take take of the columns as well.

I wouldn't give up yet, as you literally need to change 1 line of code to get this working properly. Take a look below, all I did is move all the closing tags to below your isset() content.

Code: Select all

<tr>
      <td width="100"><center><font style="font-size:14px" color="#FFFFFF" face="Arial"><?=$ReportedPlayer?></center></font></td>
      <td width="100"><center><font style="font-size:14px" color="#FFFFFF" face="Arial"><a href="pendingreports.php?view=<?=$RecordID?>" style="color:#FFFFFF">View</a>
<?
         If(isset($_GET['view'])){
?>
               <font style="font-size:13px" color="#FFFFFF" face="Arial">UserID: <?=$UserID?><br>
                  UserName: <?=$UserName?><br>
                  Money: <?=$Money?><br>
                  <br>
               <a href="viewuerslogs.php?logs=<?=$UserID?>" style="color:#FFFFFFF">View users logs</a><br>
               <a href="viewusersmessages.php?messages=<?=$UserID?>" style="color:#FFFFFF">View users messages</a><br>
               <a href="Viewusersonsameip.php?ip=<?=$UserID?>" style="color:#FFFFFF">View users on same IP</a></font></div>
               <b><u>Player Report Infomation:</u></b><?=$Info?>
               <a href="closereport.php?report=<?=$RecordID?>" style="color:#FFFFFF">No Evidence</a><br>
            <br>
               <a href="secondopinion.php?report=<?=$RecordID?>" style="color:#FFFFFF">Get Second Opinion</a><br>
            <br>
               <a href="punishment.php?report=<?=$RecordID?>" style="color:#FFFFFF">Guilty</a></u></b></font></div>
<?php
               }
?>
      </center></font></td>
   </tr>
<?php
         }
   }
?>