In form, I want to insert the value of amount(text input) when value of rate(another text input) . The value which will be inserted in amount is the multiplication of rate and quantity. The value of quantity is taken from database. Here, the value of rate will be inserted by user. After insertion of amount, the value can not be changed. How can i do this?
I have tried below code but result is showing zero every time:
View
<div class="form-group">
<label for="exampleInputPassword1">Rate</label>
<input type="text" class="form-control" name="rate" placeholder="Rate" required>
</div>
<div class="form-group">
<label>Quantity</label>
<input type="text" class="form-control" name="quantity" placeholder="quantity" value="<?php echo $object['sheet']; ?> " required readonly>
</div>
<div class="form-group">
<label for="exampleInputPassword2">Amount</label>
<?php
$sheet = $object['sheet'];
$rate = $this->input->post('rate');
$amount = $sheet*$rate;
echo $amount;
}
?>
<input type="text" class="form-control" name="amount" value="<?php echo $amount;?>" placeholder="Amount" required>
</div>