1
I’m running a web site of questions and answers, shuffled alternatives and etc.
I’m having trouble knowing which alternative the user clicked and whether or not it corresponds with what is written in the "altercerta" field of the bank (Mariadb). But I have no idea how to do this, the following are the codes I’m trying to make work with (obviously not working)
<button type="button" ng-class="p1a1" style="float: center;width: 80%" ng-click="p1click(1)"><?php echo $alternativas1[0] ?></button> <br><br>
<button type="button" ng-class="p1a2" style="float: center;width: 80%" ng-click="p1click(2)"><?php echo $alternativas1[1] ?></button> <br><br>
<button type="button" ng-class="p1a3" style="float: center;width: 80%" ng-click="p1click(3)"><?php echo $alternativas1[2] ?> </button> <br><br>
<button type="button" ng-class="p1a4" style="float: center;width: 80%" ng-click="p1click(4)"><?php echo $alternativas1[3] ?></button> <br><br>
<button type="button" ng-class="p1a5" style="float: center;width: 80%" ng-click="p1click(5)"><?php echo $alternativas1[4] ?></button> <br><br>
so I put a
<input type="hidden" name="question1" ng-model="question1">
with this attempt
php $alternativastentativa[0] = "question1" ?>
That one ng-model="question1"
comes from js
where it receives the value from 1 to 5 according to which button the user click.
FOCUS ON THIS PART:
I’m trying with this code to compare and I have no idea how to do it properly:
$respostacerta1 = 4
(I set standard values until it works)
<?php
if ($respostacerta1 == $alternativastentativa[0]){
$contadoracertos = $contadoracertos++;
}
?>