This is simple but I don't seem able to make it happen in Codeigniter.
Using simple php it should be:
<form id="volume" method="post" action="<?php echo $PHP_SELF;?>">
<label>length(cm):</label>
<input type="text" name="length">
<label>width(cm):</label>
<input type="text" name="width">
<label>height(cm):</label>
<input type="text" name="height">
<button type="submit">Submit</button>
</form>
<?php
$length = $_POST["length"];
$width = $_POST["width"];
$height = $_POST["height"];
$variable = 5000;
$sum_total = ($length * $width * $height) / $variable;
printf ("%01.2f" , $sum_total);
?> kg
I put the form in my view, the php in my controller but I want it to return the result in the same page instead of redirecting me.
Thank you all in advance for your responses.