Josepheuan Posted February 23, 2009 Share Posted February 23, 2009 I've got a quote calulator form (in php) on my site so customers can get a quote for the sizes they need. The problem I got, is if the price is £32.60. The page outputs £32.6 Is there anyway to make it add the last zero when there's meant to be one? Thanks Joseph Quote Link to comment https://forums.phpfreaks.com/topic/146492-solved-adding-a-zero-on-the-end-of-output/ Share on other sites More sharing options...
andy_b42 Posted February 23, 2009 Share Posted February 23, 2009 http://uk.php.net/round something like: round($value, 2); Quote Link to comment https://forums.phpfreaks.com/topic/146492-solved-adding-a-zero-on-the-end-of-output/#findComment-769039 Share on other sites More sharing options...
sasa Posted February 23, 2009 Share Posted February 23, 2009 http://hr.php.net/number_format Quote Link to comment https://forums.phpfreaks.com/topic/146492-solved-adding-a-zero-on-the-end-of-output/#findComment-769069 Share on other sites More sharing options...
Josepheuan Posted February 23, 2009 Author Share Posted February 23, 2009 This is what I have at the moment. I'm still learning, so no doubt the code layout is crap and wrong :\ <? $height=$HTTP_POST_VARS['height']; $width=$HTTP_POST_VARS['width']; Print $width; ?>ft x <? $height=$HTTP_POST_VARS['height']; $width=$HTTP_POST_VARS['width'];Print $height; ?>ft full colour banner is:<br /> <? $height=$HTTP_POST_VARS['height']; $width=$HTTP_POST_VARS['width']; $servicefee = 0; $Inchcost = 3.60; $width = $width; $height = $height; $cost = ($Inchcost * $width * $height) + $servicefee; Print $cost; ?> Quote Link to comment https://forums.phpfreaks.com/topic/146492-solved-adding-a-zero-on-the-end-of-output/#findComment-769072 Share on other sites More sharing options...
sasa Posted February 23, 2009 Share Posted February 23, 2009 print number_format($cost, 2); Quote Link to comment https://forums.phpfreaks.com/topic/146492-solved-adding-a-zero-on-the-end-of-output/#findComment-769075 Share on other sites More sharing options...
Josepheuan Posted February 23, 2009 Author Share Posted February 23, 2009 Thanks sasa! I'm really liking PHP! Quote Link to comment https://forums.phpfreaks.com/topic/146492-solved-adding-a-zero-on-the-end-of-output/#findComment-769077 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.