Auto fill field...
i have form collects currency value data.
what trying achieve obtain calculated value, based on above, appear in text field automatically before submit. value saved db on submit.
for instance:
<?php
$unitvalue=$post_vars['textfieldunitvalue'];
$quantity=$post_vars['textfieldquantity'];
$totalvalue=($unitvalue*$quantity);
?>
<td><input name="textfieldtotalvalue" type="text" id="textfieldtotalvalue" value=$totalvalue></td>
i assume though both , post methods activate on "sumbit"
how achieve autofill functionality?
is there simpler solution?
what trying achieve obtain calculated value, based on above, appear in text field automatically before submit. value saved db on submit.
for instance:
<?php
$unitvalue=$post_vars['textfieldunitvalue'];
$quantity=$post_vars['textfieldquantity'];
$totalvalue=($unitvalue*$quantity);
?>
<td><input name="textfieldtotalvalue" type="text" id="textfieldtotalvalue" value=$totalvalue></td>
i assume though both , post methods activate on "sumbit"
how achieve autofill functionality?
is there simpler solution?
hi,
you´re approach correct, you´ll need enclose text field´s value in <?php ... ?> , in here "echo" variable, means:
<td><input name="textfieldtotalvalue" type="text" id="textfieldtotalvalue" value="<?php echo $totalvalue; ?>"></td>
the way it´s now, visitor able change or erase field´s contents, if don´t want happen, should better make hidden field, means...
<input type="hidden" name="textfieldtotalvalue" id="textfieldtotalvalue" value="<?php echo $totalvalue; ?>">
...and additionally "echo" result plain text
you´re approach correct, you´ll need enclose text field´s value in <?php ... ?> , in here "echo" variable, means:
<td><input name="textfieldtotalvalue" type="text" id="textfieldtotalvalue" value="<?php echo $totalvalue; ?>"></td>
the way it´s now, visitor able change or erase field´s contents, if don´t want happen, should better make hidden field, means...
<input type="hidden" name="textfieldtotalvalue" id="textfieldtotalvalue" value="<?php echo $totalvalue; ?>">
...and additionally "echo" result plain text
More discussions in Develop server-side applications in Dreamweaver
adobe
Comments
Post a Comment