What function to use to output the result for a given formula?

Good day! Please suggest what features can be used to implement the plan? Where you can read about it?

There is a table in which 3 fields (2 for input and 1 for output)

1. forecast - 2 digits;
2. the result is 2 digits;
3. points - 1 digit.

Logic formulas to output the result in the "score" is:

2 the numbers in the "forecast" (they can assign a value to P1 and P2) are compared with the digits in the result (r1 and r2)

If the values are the same example - the forecast 2:1 2:1 in the score field comparison table displays the number "6"
All other mismatches are calculated on the principle of the maximum possible number of points (out of 6) is subtracted the difference between the "forecast", the result taken modulo. The result is obtained number of points.

Example:
the forecast— 1:2
result— 3:4
the number of points = 6 - | 1 - 3 | - | 2 - 4 | = 6 - 2 - 2 = "2"
July 2nd 19 at 14:13
2 answers
July 2nd 19 at 14:15
There is a table in which 3 fields (2 for input and 1 for output)

1. forecast - 2 digits;
2. the result is 2 digits;
3. points - 1 digit.


Choose your fields, store them in variables. Take of them of value; because the value consists of two digits, take the first digit, then the second. The values lowercase, so we need to bring to the number. Now that you have all the values that can be substituted in your formula in which the maximum number of points deducted modules of the difference scores.
thank you, I will understand a little - laverne_Lebsa commented on July 2nd 19 at 14:18
July 2nd 19 at 14:17



 <meta charset="UTF-8">
 <meta name="description" content="My template">
 <title>My template</title>

 <!-- style -->
 <link rel="stylesheet" href="style/style.css">
 <!-- jquery script -->
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
 <script type="text/javascript" src="js/jquery.cookie.js"></script>
 <script src="js/main.js"></script>





 <!--// form inside a table//-->

<form method="post" id="myform"></form>
<table>
<tbody><tr>
<td bgcolor="white"> Team 1
 <input type="text" style="width: 30px" name="text" form="myform">
 <input type="text" style="width: 30px" name="text" form="myform">

 </td><td bgcolor="white">Command 2 Result

<input type="text" style="width: 30px" name="text" form="myform">
<input type="text" style="width: 30px" name="text" form="myform">
Glasses
<input type="text" style="width: 30px" name="text" form="myform">
</td>
</tr>

the <tr>
 <td> <br><br>
<input type="submit" name="add", form="myform">
</td>

</tr>
</tbody></table>




Find more questions by tags JavaScriptPHP