I'd like to know how to get a value of input
, calculate it, and play the result on another input
. Example: imc = peso x (altura)²
.E When the person places the height and weight in the inputs
, the calculation will be done and will appear in input
of the IMC.
I also have to perform calculations in other fields, but I would like help because I do not know how to do these calculations, whether in PHP itself or JavaScript?
Follow the code below:
<div>
<input class="campo-form-c" type="text" name="pesoatual" placeholder="Peso Atual">
</div>
<div>
<input class="campo-form-c" type="text" name="altura" placeholder="Altura">
</div>
<div>
<input class="campo-form-c" type="number" name="idade" placeholder="Idade"></br>
</div>
<div>
<input class="campo-form-c" type="date" name="datan" placeholder="Data de nascimento"></br>
</div>
<div>
<input class="campo-form-c" type="text" name="medidab" placeholder="Medida do Braço" maxlength="5">
</div>
<div>
<input class="campo-form-c" type="text" name="medidat" placeholder="Medida Tricipital" maxlength="5">
</div>
<div>
<input class="campo-form-c" type="text" name="medidaabd" placeholder="Medida Abdominal" maxlength="5"></br>
</div>
<div>
<input class="campo-form-c" type="text" name="imc" placeholder="IMC" maxlength="4">
</div>
<div>
<input class="campo-form-c" type="text" name="gorduratricpital" placeholder="Gordura Tricipital" maxlength="5">
</div>
<div>
<input class="campo-form-c" type="text" name="circunferenciabraço" placeholder="Circunferência do Braço" maxlength="5"></br>
</div>
<div>
<input class="campo-form-c" type="text" name="circunferenciambraço" placeholder="Circunferência Muscular do Braço" maxlength="5"></br>
</div>