karimali831 Posted November 4, 2010 Share Posted November 4, 2010 Hi, Example: echo percent(5, 10, 2)."%"; gives you 50% Instead of this representation, I want to use a bar like this: So what ever percentage it is, it will show on the bar. (out of 100%) anyone help me achieve this please? Thanks function percent($sub, $total, $dec) { if ($sub) { $perc = $sub / $total * 100; $perc = round($perc, $dec); return $perc; } else return 0; } Quote Link to comment Share on other sites More sharing options...
waynew Posted November 4, 2010 Share Posted November 4, 2010 You can do this using CSS. Set the main container: <div style="width:100px; background-color:#fff; border:#eee 1px solid; height:30px;"> <div style="width:<?php echo $percent; ?>%; background-color:#eee;"> <> <> Quote Link to comment Share on other sites More sharing options...
karimali831 Posted November 4, 2010 Author Share Posted November 4, 2010 Now I get the CSS right, but it don't show the percent: $ratio = '<div style="width:'.$challenger_ratio.'%; background-color:#333333;">'; http://team-x1.co.uk/site/index.php?site=standings&ladderID=16 Thanks for help! Quote Link to comment Share on other sites More sharing options...
karimali831 Posted November 4, 2010 Author Share Posted November 4, 2010 Me being daft, solved it. Thanks!! Quote Link to comment Share on other sites More sharing options...
waynew Posted November 4, 2010 Share Posted November 4, 2010 Ah! A fellow COD player 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.