telebofh Posted March 8, 2008 Share Posted March 8, 2008 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 Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted March 8, 2008 Share Posted March 8, 2008 remove the style completely. Quote Link to comment Share on other sites More sharing options...
telebofh Posted March 8, 2008 Author Share Posted March 8, 2008 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! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.