I try to make math calculation which is not visible to the user or robots.
How to make working mathematical formulas?
The object math_validation uses parameters calcsettings with an array value like minimum, maximum and calculation method.

```
<?php
function math_validation( $calcsettings ) {
Math settings
array(
'min' => 1,
'max' => 15,
'cal' => array( '+', '*' ),
);
$calcsettings['max'] = 5;
return $calcsettings;
}
?>
```

Gandalf
December 17, 2020, 12:36pm
2
Without having the code around this, it’s impossible to say.

chorn
December 18, 2020, 1:47pm
3
works as expected

```
<?php
function math_validation( $calcsettings ) {
$calcsettings['max'] = 5;
return $calcsettings;
}
$calcsetting = array(
'min' => 1,
'max' => 15,
'cal' => array( '+', '*' ),
);
print_r(math_validation($calcsetting));
/*
Array
(
[min] => 1
[max] => 5
[cal] => Array
(
[0] => +
[1] => *
)
)
```

As we have now array values and mathematical calculation, how to bring values into input cell like:
3*5 = 15
1+4 = 5
Result:

```
Array
(
[min] => 1
[max] => 5
[cal] => Array
(
[0] => +
[1] => *
)
)
```

Should be used JavaScript due to this response math_val? I have added onFocus=“mathcalculation()” which can be used for JavaScript.
HTML:

```
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html" />
<title>Math validation</title>
</head>
<body>
<form id="form-validation1" class="form-validation1" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<input type="hidden" data-math="" name="" class="form-control" placeholder="" readonly />
<input type="hidden" data-math="" name="" class="form-control" placeholder="" readonly />
<input id="math_val" onFocus="mathcalculation()" type="number" name="math_val" maxlength="2" class="form-control" placeholder="Enter result like 2 + 5 = 10" />
</form>
</body>
</html>
```

system
Closed
March 23, 2021, 5:39pm
5
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.