Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Oct 2004
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question PHP ROI calculator This is a hard one!

    Hi I am tring to put together this ROI calculator but I cant get the calculations right. The calculations is suppose to calculate multiply results. This is going to to be hard to explain but it calculates correct sometimes. I dont know what to do. Some calculations are right on the dot and some are just totally wrong. I have tried everything I know but still can figure it out. Any help would be great THANK YOU.

    Here is the link to the calculatorROI calculator


    PHP Code:
    <?
    if ($_POST['submit'] && $_POST['responserate'] && $_POST['numberofpieces'] && $_POST['conversionrate'] && $_POST['averagespend'] && $_POST['programcost']) {
      
    $ResponsePer $_POST['responserate'] / 100;
      
    $NumberResponse $ResponsePer $_POST['numberofpieces'];

      
    $ConversionPer $_POST['conversionrate'] / 100;
      
    $buyers $ConversionPer $NumberResponse;

      
    $TotalRevenue $buyers $_POST['averagespend'];

      
    $CostPerBuyer $_POST['programcost'] / $buyers;

      
    $CostPerResponse $_POST['programcost'] / $NumberResponse;

      
    $CostPerPiece $_POST['numberofpieces'] / $_POST['programcost'];
      
    $ans $TotalRevenue $_POST['programcost'];
      
    $roi $ans $_POST['programcost']* 100;


      
      echo 
    "<center><table border='2' rules='groups' frame='hsides' cellpadding='5' cellspacing= '5'>
            <caption><h2><b> ROI Results</b></h2></caption></center>
                                  \n"
    ;
      echo 
    "<tr><td> <b> # OF BUYERS</b></td><td>".round($buyers)."<td><b>Cost Per Piece</b></td><td>"."$".round($CostPerPiece)."\n";
      echo 
    "<tr><td><b># OF RESPONDERS</b></td><td>".round($NumberResponse)."<td><b>Cost Per Response</b></td><td>"."$".round($CostPerResponse)."\n";
      echo 
    "<tr><td><b>TOTAL REVENUE</b></td><td>"."$".round($TotalRevenue)."<td><b>Cost Per Buyer</b></td><td>"."$".round($CostPerBuyer)."\n";
      echo 
    "<tr><td><b>ROI</b></td><td>".$roi."%"."</td></tr>\n";

    }
    ?>

  • #2
    Senior Coder
    Join Date
    Aug 2003
    Location
    One step ahead of you.
    Posts
    2,815
    Thanks
    0
    Thanked 3 Times in 3 Posts
    Just find a working ROI calculting algorythm and use it.
    No errors found. Just watch out for division by 0.
    Yes I have no idea what ROI is.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •