Tom Kroscavage
Member
Posted 2 years ago #
I would like to add a 2-stroke oil-gas mix calculator to a post. I've added the php-exec plug-in. what should the php code look like? I need to multiply the amount of galons by 128 and divide by the mixture like 50 (50:1)
If someone could post a simple addition calculator that works with php-exec that would be very helpful to me.
ClaytonJames
Member
Posted 2 years ago #
Tom Kroscavage
Member
Posted 2 years ago #
Every time I paste a calculator from the internet the form works then when I press the calculate button the browser navigates back to my home page.
Tom Kroscavage
Member
Posted 2 years ago #
Here is my code in a post
<?php
if($submit)
{
if($operator == '*')
{
echo $numa * $numb;
} elseif($operator == '/')
{
echo $numa / $numb;
} elseif($operator == '+')
{
echo $numa + $numb;
} elseif($operator == '-')
{
echo $numa - $numb;
}
} else { ?>
<form method="POST" action="<?php $_SERVER['PHP_SELF']; ?>">
<input type="text" name="numa" size="10">
<input type="text" name="operator" size="2">
<input type="text" name="numb" size="10">
<input type="submit" value="Calculate" name="submit">
</form>
<?php } ?>