0
I have to make a form in PHP that calculates the distance, speed and time that a person makes during a journey and tell how many liters were used, but I’m struggling to make sense of the form.
Calculation
<form action=calculadora.php" method="get" />
<p> Distancia : <input name="num1" type="text" /> </p>
<p> Tempo : <input name="num2" type="text" /> </p>
<p> Velocidade : <input name="num3" type="text" /> </p>
<p> Litros Usados : <input name="num4" type="text" /> </p>
<input type="submit" value="Calcular" />
</form>
<?php
$num1=$_GET['num1'];
$num2=$_GET['num2'];
$num3=$_GET['num3'];
$num4=$_GET['num4'];
//Aqui ira o calculo dos valores Num1 Num2 Num3
$d= $num2*$num3; //d= Distancia
$l= $d/12; //l- Litros Usados
?>
</body>
What’s the problem ? Apparently you’re sending by
GET
forcalculadora.php
, then need to calculate in this file or do viaJS
,JQUERY
, etc.– rbz
Your question doesn’t make much sense. You want to calculate "what?" if your form already asks all rss
– Sam