I am a newbie programming in PHP and I need to make a form using if-else where the user enters the value of a product and choose a payment plan of a select to calculate the interest and total amount.
The plans are as follows:
- panel A iteres 10%
- panel B interest 20%
- panel C interest 34%
- panel D interest-free interest
This is the code of the form:
<form action="enviar.php" method="GET">
<select name="opciones" id="">
<option value="plan1">Plan A</option>
<option value="plan2">Plan B</option>
<option value="plan3">Plan C</option>
<option value="plan4">Plan D</option>
</select>
<br>
Ingrese el monto:
<input type="number" name="dinero"><br>
<input type="submit" value="Enviar">
</form>
And the PHP code that processes it:
<?php
$costo = $_POST["dinero"]."<br>";
$opciones = $_POST["opciones"];
if ($opciones == "plan1") {
$resultado1 = $costo *10/100;
$total = $resultado1 + $costo;
echo "El interes es: ".$resultado3"El valor total es: ".$total;;
}
else ($opciones == "plan2") {
$resultado2 = $costo *20/100;
$total = $resultado2 + $costo;
echo "El interes es: ".$resultado2"El valor total es: ".$total;;
}
else ($opciones == "plan3") {
$resultado3 = $costo *34/100;
$total = $resultado3 + $costo;
echo "El interes es: ".$resultado3. "El valor total es: ".$total;
}
else ($opciones == "plan4") {
echo "Sin Interes";
?>