Jump to content

display not working correctly


telebofh

Recommended Posts

Hi, I have a php script that gets the status of 5 computers and then posts them.  It posts all the data correctly but they show up on the webpage all top of each other and I'm not sure how to alter them so they layout side by side.

 

display script server side:


$filename = './data.dat';


$postvars = unserialize(file_get_contents($filename));


// print_r ($postvars); 





$i = 0;





for($i = 0; $i <= $postvars['ComputerCount']; $i++)


{


switch($postvars['Computer' . $i . '_State'])


{


   case '0':


    $statustext = "Unavailable / Off";


    break;


   case '1':


    $statustext = "Available for use!";


    break;


   case '2':


    $statustext = "Unavailable / In Use";


    break; 


}





switch($postvars['Computer' . $i . '_ConsoleType'])


  {


   case '0':


?>


<div style="position:absolute;top:<? echo $postvars['Computer' . $i . '_X']; ?>px;left:<? echo  $postvars['Computer' . $i . '_Y']; ?>px;width:32px;height:32px;" onMouseOver="return escape('<b>Computer #<? echo $i ?><br>Status:</b> <? echo $statustext ?>')">


	<img src="./images/pc_<? echo $postvars['Computer' . $i . '_State']; ?>.png" alt="Computer #<? echo $i ?>">


</div>


$filename = './data.dat';


$postvars = unserialize(file_get_contents($filename));


// print_r ($postvars); 





$i = 0;





for($i = 0; $i <= $postvars['ComputerCount']; $i++)


{


switch($postvars['Computer' . $i . '_State'])


{


   case '0':


    $statustext = "Unavailable / Off";


    break;


   case '1':


    $statustext = "Available for use!";


    break;


   case '2':


    $statustext = "Unavailable / In Use";


    break; 


}





switch($postvars['Computer' . $i . '_ConsoleType'])


  {


   case '0':


?>


<div style="position:absolute;top:<? echo $postvars['Computer' . $i . '_X']; ?>px;left:<? echo  $postvars['Computer' . $i . '_Y']; ?>px;width:32px;height:32px;" onMouseOver="return escape('<b>Computer #<? echo $i ?><br>Status:</b> <? echo $statustext ?>')">


	<img src="./images/pc_<? echo $postvars['Computer' . $i . '_State']; ?>.png" alt="Computer #<? echo $i ?>">


</div>


 

What happens:

 


<div style="position:absolute;top:0px;left:0px;width:32px;height:32px;" onmouseover="return escape('<b>Computer #1<br>Status:</b> Available for use!')">


	<img src="./images/pc_1.png" alt="Computer #1">


</div>




<div style="position:absolute;top:0px;left:0px;width:32px;height:32px;" onmouseover="return escape('<b>Computer #2<br>Status:</b> Available for use!')">


	<img src="./images/pc_1.png" alt="Computer #2">


</div>




<div style="position:absolute;top:0px;left:0px;width:32px;height:32px;" onmouseover="return escape('<b>Computer #3<br>Status:</b> Unavailable / In Use')">


	<img src="./images/pc_2.png" alt="Computer #3">


</div>




<div style="position:absolute;top:0px;left:0px;width:32px;height:32px;" onmouseover="return escape('<b>Computer #4<br>Status:</b> Available for use!')">


	<img src="./images/pc_1.png" alt="Computer #4">


</div>




<div style="position:absolute;top:0px;left:0px;width:32px;height:32px;" onmouseover="return escape('<b>Computer #5<br>Status:</b> Available for use!')">


	<img src="./images/pc_1.png" alt="Computer #5">


</div>




 

As you can see, it gets all the data and posts it correctly except they all have the same location position:absolute;top:0px;left:0px

 

I'm not sure how to add something in there to make it display differently

 

Thanks for any help on this, I don't know anything about php! lol

Link to comment
https://forums.phpfreaks.com/topic/95116-display-not-working-correctly/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.