Introduction of formulas in the Web application

-2

Greetings! I'm developing a web application, with the tools (HTML + CSS + JAVASCRIPT) {BootStrap} + PHP + MySQL. It is a kind of teacher's notebook, and at some point the teacher will have to enter the formula for calculating the average of frequency for example. Based on the formula that the prof is to introduce, I will need to generate a table where the student's note will be displayed on each of the variables entered in the formula.

Example: The formula being: Mf = T1 (25%) + T2 (25%) + TG (35%) + AC (15%); where: Mf -> average frequency; T1 - > Test1; T2 - > Group work; AC - > Ava; continuous ionization;

The point is I'm looking for a way for the user to enter the formula as simply as possible. How can I do this?

    
asked by anonymous 02.05.2018 / 08:49

2 answers

0

Try to do something more or less along those lines.

<div id="inputs">

</div>
<script>
    let z = document.createElement("INPUT");
    z.setAttribute("type", "text");
    z.setAttribute("name", "t1");
    z.setAttribute("id", "t1");
    document.getElementById('inputs').append(z);
</script>

To create the fields on screen with the amount of notes the teacher reports.

    
02.05.2018 / 13:39
-1

The easiest way:

<!DOCTYPE html>
    <html>
    <body>
        <form action="/inserirnotas.php">
        MF: <input type="text" name="media><br>
        T1: <input type="text" name="t1"><br>
        T2: <input type="text" name="t2"><br>
        AC: <input type="text" name="ac"><br>
        <input type="submit" value="Submeter">
        </form>
        <?php
        $calculo = $_POST['media']*0.25 + $_POST['t1'](25%) + $_POST['t2']*0.35 + $_POST['ac']*0.15;
        echo $calculo;
        ?>
    </body>
    </html>
    
02.05.2018 / 10:46