What the title says, I'm doing a project and in a specific part I want to add 1 to the value of a variable, I hope that with the code they understand my doubt
$resultado = $_POST['resultado'];
Suppose that the value sent by the form is 10. And I have a scale of results ranging from -18 to 18, that is.
-10 a -18 = N
-1 a -9 = LN
0 = S
1 a 9 = LP
10 a 18 = P
Then ...
if ($resultado == 0) {
$S++;
} elseif ($resultado >= 1) {
$LP++;
} elseif ($resultado >= 10) {
$P++;
} elseif ($resultado <= -1) {
$LN++;
} elseif ($resultado <= -10) {
$N++;
}
When the result is from 1 to 9 the variable $LP
increases, the problem is that when the result goes from 10 to 18 instead of increasing the variable $P
increases the variable $LP
and the same happens to me with the variables $LN
and $N
.