Introducing formulas in the web application

Asked

Viewed 33 times

-2

Greetings! I am 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 introduce the formula for calculating the average frequency for example. Based on the formula that the prof will enter, I will need to generate a table where the student’s grade will be displayed in 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 -> Teste1; T2 -> Group work; AC -> Ava; continuous action;

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

2 answers

0

Try to do something more or less like that.

<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 that the teacher informs.

  • Thanks, help!

-1

The easy 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>
  • 1

    thanks! , I got an idea of what I should do.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.