redarrow Posted October 9, 2009 Share Posted October 9, 2009 <?php session_start(); function add_shopping($price,$quienty,$shipping,$discount,$tax,$payments){ $total=($price*$quienty)+($shipping)-($discount); $taxrate=($tax/100)+1; $total=$total*$taxrate; $monthly=$total/$payments; $_SESSION['monthly']=$monthly; $_SESSION['total']=$total; $_SESSION['payments']=$payments; return; } echo add_shopping('20.00','10','7.50','10%','17.50','12'); echo "Complete total ".£.number_format($_SESSION['total'],2)."\n <br> <br> ".$_SESSION['payments']." monthly payments ".£.number_format($_SESSION['monthly'],2)."<br>"; ob_start(); echo "<br> ".$_SESSION['payments']='52'." weekly payments ".£.number_format($_SESSION['monthly']/4,2)." "; ob_flush(); ?> Your all notice there the php function ob_start used on this page, and might wonder why, also there ob_flush() used at the end of the page. grate stuff i say.... i reset the session so there no conflict to 52 without ob_start() and ob_flash never do that it change all numbers and give wrong result. Quote Link to comment Share on other sites More sharing options...
jon23d Posted October 9, 2009 Share Posted October 9, 2009 I use output buffering for exceptions everywhere. It enables me to easily log trace and object information. Quote Link to comment Share on other sites More sharing options...
Adam Posted October 9, 2009 Share Posted October 9, 2009 never do that it change all numbers and give wrong result What does it change the numbers too? What result does it give? You have a syntax error on the last two echo statements, a pound sign not wrapped in quotes. Is English your primary language? Quote Link to comment Share on other sites More sharing options...
redarrow Posted October 9, 2009 Author Share Posted October 9, 2009 yes but i am completely blind have key board problems why? 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.