Hello evreyone,
I am EXTREMELY new to PHP, I am still trying to learn where all the resources are yet
What I am trying to do is to make a caculator that will take and imputed number and caculate a percentage of it as a fee but I also want it to calulate a second fee percentage for if they were to sign up withthe service.
Be something like this
Amount of transaction: $1000.00
Standard Fee: $50.00
Gold Free: $30.00
I was just wondering if anyone would know where i could find a torturial or something on how to caculate something like this... or a pre exsisting script i might base it off of.
Thank you for any assistance
Dang did you make that on the fly?
that was a fast reply and i have to say i must bow down to your greatness LOL
yeah its pretty close to what i am thinking... though why does it refreash the page? does it have to?
And I guess since you here to ask
if i wanted to add say an equation like 0-1000 = 3% 1000.01 to 5000 = 5% and so forth but still utilize the standard vrs gold vrs.
I am thinking i would have to do an if statment to seperate the different variables and caculate from there... right? Or do i sound as dumb as i am feeling right now?
when you hit the submit button the page resets to the awnser (in other words the part where you input the info changes to just the awnser) this is excepable i can certainly work with it but i was just cuious why it does. And i am useing IE most recent
the idea here is sort of like an excrow service (though not what i am doing)
i have a percentage fee basied on the amount of the trasaction
soemthing like this
$0 - 500 i get 5%
500.01 - 1000 4.5%
ect ect
or if htey pay a monthly fee the percentages drop
and i think thats what you got there though i have to play with and see
Thank again for your help i do apreciate it... ALOT
Originally posted by shatter I am really impressed withyou speed though i am guessing you probably think in PHP and not english right? heheh
hehe something like that
ok sorry took so long replying was taking timeout watching a dvd, anyway the page doesnt refresh for me, you say you are using IE, may i slap you? try this for me http://www.mozilla.org/firefox/ and download http://www.chrispederick.com/work/firefox/webdeveloper/ this once in firefox, firefox is a browser and that is a brillaint webdev extension for it, and then tell me you still use IE ? , right....
i think i now understand you meaning of 'refresh', PHP is a server side language therefore is server parsed, meaning the html form sends request to the server, php calculates the values and sends them back in HTML form. the reason why the form does not show on the second page is because of the exit() which tells php to basically end the HTML output here, try removing it and see what it does
ok so the percentage is kinda like a fee ok try this keep all the same but change the PHP to
PHP Code:
<?php
if(isset($_POST["cal"])) {
if($_POST["number"] == "" || !is_numeric($_POST["number"])) {
echo "You Must Enter A Number</body></html>";
exit();
} else {
$number = $_POST["number"];
if($number <= 500) {
$new = (5/100)*$number;
} elseif($number > 500 && $number <= 1000) {
$new = (4.5/100)*$number;
} elseif($number > 1000 && $number <= 1500) {
$new = (4/100)*$number;
//you could continue here by adding more elseif() continuing the above pattern, but keep the else this is for anything that doesnt fit the above if() or elseif()s
} else {
$new = (3.5/100)*$number;
}
echo "Transfer After Fees: $".number_format($new, 2, '.', '')."</body></html>";
exit();
}
}
?>
Looks great so far
and when do you want to do free lance work for me
so far it looks great... except i think we lost the gold and standard part in this or maybe i am missing something... ok i am missing something LOL
I am tihnking i should just add the
$stand = (5/100)*$number;
$gold = (3/100)*$number;
to the if statments... i am going ot try it out just after dinner but figured i should ask so you have time to post when i find out i am doing it wrong and start pulling my hair out LOL
OOh and i am codeing to my audiance which is 100% IE browsers
Of course right now the browser is only HTML 1.0 enabled but next month its supposed to go to HTML 4.0... if that even remotely gives you an idea of my nightmare LOL
Bookmarks