I have the following problem:
I have my code in HTML where I receive several inputs through a foreach of a table in a DB, normally this returns 3 or 4 fields to enter numbers depending on the data, the code is as follows:
foreach($data["usuarios"] as $dato){
$pco_nombre = $dato["pco_nombre"];
?> <p class="card-text"><strong><?= echo $pco_nombre; ?></strong></p>
<label>Votacion:</label>
<input type="number" name="votacion[]" id="votacion"></input>
</div>
<button type="submit" id="submit3" name="boton1" class="btn btn-secondary" value="Guardar" type="button">Asignar Votacion</button>
</div>
</form>
</div>
</div>
<?php
}
My question is: How could I make the values that are entered in the field: " <input type="number" name="votacion[]" id="votacion"></input>
, be validated before redirecting to the action of the form, in such a way that if the value that was entered in field 1 is equal to field 2 3 or 4 send a type of alert? Thank you very much in advance! I appreciate any contribution.
Here is an example of what you need
Loop through the inputs with the class and check the value to see if it echoes