dongpu2476 2013-11-07 21:46
浏览 35
已采纳

公式计算器表格[已结束]

I am looking to build a simple one-field form that will take the number entered and run it through a formula and display the result underneath on a webpage for a school project. Similar to a paypal fee calculator. NO more, no less.

I can handle HTML, CSS, JS, but am pretty PHP-tarded.

Is there something I can read to learn how to go about this? I tried searching but am not sure exactly what I should be searching for.

Thanks

  • 写回答

2条回答 默认 最新

  • douchuang1852 2013-11-07 21:59
    关注

    Name the field that you are entering, i.e.

    <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
        <input type="text" name="value" value="">
        <input type="submit" value="Submit">
    </form>
    <?php
    $value=$_POST['value'];
    if ($value!=""){
        //RUN FORMULA HERE:
        $total=$value * 1.02;
        echo $total;
    }
    ?>
    

    Using this method will allow you to continue entering numbers until you are done.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?