Compare what is written on a button with the field in php

1

I'm running a question and answer site, shuffled alternatives, and so on.

I'm having trouble knowing what alternative the user clicked on and whether or not it corresponds to what is written in the bank's "altercerta" field (MariaDB). But I have no idea how to do this, here are the codes that I'm trying to work with (obviously they are 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>

Then I put one

<input type="hidden" name="question1" ng-model="question1">

with this attempt

php $alternativastentativa[0] = "question1" ?>

This ng-model="question1" comes from js where it receives the value from 1 to 5 according to which button the user clicks.

FOCUS ON THIS PART:

I'm trying with this code to compare and I have no clue how to do it correctly: $respostacerta1 = 4 (I set default values until it works)

<?php 
   if ($respostacerta1 == $alternativastentativa[0]){
       $contadoracertos = $contadoracertos++;
   }
?>
    
asked by anonymous 01.06.2017 / 01:07

0 answers