I have a 4 input boxes, 3 are hidden fields. The first input box take a figure, while the second displays 20% of the figure and the 3rd displays the answer gotten from subtracting 20% of the initial figure from the figure. here is a typical example of what i mean.
textbox A = 100
20% of 100 = 20.
textbox B = 20.
100 - 20 = 80.
textbox C = 80
i have been able to do all this and passed the variables to the input box, but when i load the page it populates the textbox with undefined variable and when i click on the button it execute the script and the initial text that says undefined variable is inserted into my db. how do i post the answer into my db instead of post what loads with the page. here is my code.
When it loads up:
<?php
if (isset($_POST['amount'])&&  ($_POST['iniamount']) && 
($_POST['outamount'])) {
    $amount = $_POST['amount'];
    $iamount = 0.2;
    $inimain = $iamount * $amount;
    $outamount = $amount - $inimain;    
}
$date = date("Y-m-d H:i:s");
?>
here is the form
<div class="form">
    <form method="POST" enctype="multipart/form-data" name="donation" class="" >
        <div class="form-group ">
            <label for="cname" class="control-label col-lg-2">Donation Amount <span class="required">*</span></label>
            <div class="col-lg-10">
                <input class="form-control" id="amount" name="amount"  type="text" required />
                <input name="email" type="hidden" class="form-control" id="email"  required />
                <input name="iniamount" type="text" class="form-control" id="iniamount" value="<?php echo $inimain; ?>" required />                             
                <input name="outamount" type="text" class="form-control" id="outamount" value="<?php echo $outamount;  ?>" required />
                <input name="date" type="hidden" class="form-control" id="outamount" value="<?php echo $date;  ?>"  required />
            </div>

 
     
     
     
    