SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    I LOVE THIS SITE ! ! ! DougD's Avatar
    Join Date
    May 2000
    Location
    San Diego, CA
    Posts
    463
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am working on a poject and I am having problem with a script I had done.

    Go to:
    http://www.dotdealers.com/calc.php

    Enter 29.95 and click Calculate Profit. See where it says $1.410 (credit card processing fee - 5%)... It should come out with $1.50. The credit card processing fee should be 5% of the amount entered. It works correctly with most amounts entered, but not all.

    Here's the script:
    http://www.dotdealers.com/calc.txt

    Any help would be greatly appreciated!

    Thanks,

    Doug

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I changed your script a bit, and got rid of some unnecessary code, I think this is what you want

    PHP Code:
    <font face="Verdana, Arial" size=2>
    <?



    if($submit){

        
    //check price is high enough
        
    if($price<10.45){
         echo 
    '<B>Price too low!! Must be at least $10.45</B><BR>';
         
    $submit="";
        }else{
                
    //calculate variables
                
    $user_cost=9.95;
                
    $credit_fee=number_format(($price*0.05), 2);
                
    $profit=number_format(($price-$credit_fee-$user_cost), 2);

    echo 
    "If you charged <b>\$$price</b>, you would make <b>\$$profit</b>
    per domain sold!<BR>"
    ;
    echo 
    "Here is how it breaks down: \$$price (price you are charging)
    minus <b>\$
    $credit_fee</b> (credit card processing fee - 5%), minus <b>\$9.95</b>
    (your cost) equals <b>\$
    $profit</b> (Profit per domain).";
    echo 
    '<P><P>';
    }

    $submit="";
    }


    if(!
    $submit){
    //display the form
    echo 'How much do you wish to sell domains to your clients for??<br>
    [Enter numbers only. Does not need $ sign.]<p>
    <form>
    <input type=text name=price>
    <input type=hidden name=submit value=go>
    <input type=submit name=some value="Calculate Profit">
    </form>'
    ;
    }


    ?>
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  3. #3
    I LOVE THIS SITE ! ! ! DougD's Avatar
    Join Date
    May 2000
    Location
    San Diego, CA
    Posts
    463
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Freddy... You are awesome!

    Works like a charm...
    http://www.dotdealers.com/calc1.php

    Thanks a ton!

    Doug

  4. #4
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No sweat!
    Please don't PM me with questions.
    Use the forums, that is what they are here for.


Bookmarks

Posting Permissions

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