• 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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter tom-kroscavage

    (@tom-kroscavage)

    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.

    Thread Starter tom-kroscavage

    (@tom-kroscavage)

    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 } ?>
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How do I add a calculator to my posts?’ is closed to new replies.