-1
I need the result of the form to be presented on the same screen, I made the following code:
<?php
//Recolhe os valores digitados no formulário
$v = $_POST['valor'];
$tm = $_POST['txmensal'];
$p = $_POST['periodo'];
$ta = (((($tm/100)+1)**12)-1)*100;
?>
Here ... the form
<form class="form form-control" method="POST">
<h5 class="mt-2">Converter juros mensais para anuais</h5>
<label for="valor" name="valor">Valor </label>
<input type="text" name="valor" class="form-control">
<label for="txmensal" name="txmensal" class="mt-1">Taxa Mensal </label>
<input type="text" name="txmensal" class="form-control" placeholder="%">
<label for="periodo" name="periodo" class="mt-1">Período </label>
<input type="text" name="periodo" class="form-control" placeholder="meses">
<input class="btn btn-default mt-1" type="submit" value="Submit">
<?php
if ($_POST['submit']){?>
<div class="alert alert-success mt-4 text-center">
<?php echo 'A taxa anual é: ' .$ta?>
</div>
<?php }?>
</form>
Post the code in text not images, post also the form that passes the data to php
– Costamilam
See if it’s clearer, I tried to simplify the code even more, just by checking if the fomulario was sent
– Flávia
change
if($_POST["submit"])
forif(isset($_POST["submit"]))
isset()
serves to know if a variable exists or not (returns a boolean), but from what I see I believe that an application with Javascript would be simpler fast or provide a better experience for the user– Costamilam
It returns the :error of the img
– Flávia