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
Share on other sites

Thanks for the quick post!  When I removed the style, it spread them out but I lost the mouse over which isn't a total loss, it does work!  If I could keep the mouse over, that would be cool, but if not, its all good.  Thanks for the help!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.