Skatecrazy1 Posted November 2, 2006 Share Posted November 2, 2006 wheee[code] <?php $self = $_SERVER['PHP_SELF']; $operator = $_POST['radio']; $value1 = $_POST['value1']; $value2 = $_POST['value2']; if(isset($operator)){ if($operator == "*"){ $final_value = $value1 * $value2; } elseif($operator == "/"){ $final_value = $value1 / $value2; } elseif($operator == "+"){ $final_value = $value1 + $value2; } elseif($operator == "-"){ $final_value = $value1 - $value2; } } else { $final_value = ""; }?><form method="post" action="<?php echo $self; ?>">First Value <input type="text" name="value1" /><br />+ <input type="radio" name="radio" value="+" /> - <input type="radio" name="radio" value="-" /> x <input type="radio" name="radio" value="*" /> / <input type="radio" name="radio" value="/" /><br />Second Value <input type="text" name="value2" /><br /><input type="submit" value="Calculate" /><br /><br />Final Value: <input type="text" value="<?php echo $final_value; ?>" /></form>[/code]see how what good use i put my time to....hooray. Quote Link to comment https://forums.phpfreaks.com/topic/25893-bored-again-made-a-calculator/ Share on other sites More sharing options...
Daniel0 Posted November 2, 2006 Share Posted November 2, 2006 Here is a challenge for you then: Try to make a calculator where you can enter simple expressions and make it calculate it... Eg: 1+2*5 Quote Link to comment https://forums.phpfreaks.com/topic/25893-bored-again-made-a-calculator/#findComment-118273 Share on other sites More sharing options...
.josh Posted November 2, 2006 Share Posted November 2, 2006 or make a graphing calculator using the gd library. Quote Link to comment https://forums.phpfreaks.com/topic/25893-bored-again-made-a-calculator/#findComment-118274 Share on other sites More sharing options...
neylitalo Posted November 2, 2006 Share Posted November 2, 2006 [quote author=Daniel0 link=topic=113561.msg461546#msg461546 date=1162450725]Here is a challenge for you then: Try to make a calculator where you can enter simple expressions and make it calculate it... Eg: 1+2*5[/quote]I suspect that's not quite what you're thinking of - [code]<?phpecho(1+2*5);?>[/code]Shows 11. Just as it should.[quote author=Crayon Violent link=topic=113561.msg461547#msg461547 date=1162450918]or make a graphing calculator using the gd library.[/quote]+10 ninja points if you get this one. That would be super cool. Quote Link to comment https://forums.phpfreaks.com/topic/25893-bored-again-made-a-calculator/#findComment-118279 Share on other sites More sharing options...
redbullmarky Posted November 2, 2006 Share Posted November 2, 2006 [quote author=neylitalo link=topic=113561.msg461552#msg461552 date=1162451710][quote author=Crayon Violent link=topic=113561.msg461547#msg461547 date=1162450918]or make a graphing calculator using the gd library.[/quote]+10 ninja points if you get this one. That would be super cool.[/quote]hmm i have this sneaky feeling that someone has read that, and is hacking up some GD scripts as we speak... Quote Link to comment https://forums.phpfreaks.com/topic/25893-bored-again-made-a-calculator/#findComment-118326 Share on other sites More sharing options...
ober Posted November 2, 2006 Share Posted November 2, 2006 haha! 500 phpfreaks bucks to anyone that can whip up something that'll do that ;) Quote Link to comment https://forums.phpfreaks.com/topic/25893-bored-again-made-a-calculator/#findComment-118410 Share on other sites More sharing options...
neylitalo Posted November 2, 2006 Share Posted November 2, 2006 [quote author=redbullmarky link=topic=113561.msg461599#msg461599 date=1162464896]hmm i have this sneaky feeling that someone has read that, and is hacking up some GD scripts as we speak...[/quote]It's just a good thing that I don't have to give anything tangible. :) I heart imaginary rewards. Except when I'm getting them. Quote Link to comment https://forums.phpfreaks.com/topic/25893-bored-again-made-a-calculator/#findComment-118421 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.