heathmont
12-14-02, 19:07
| what values are passed through to the processing of aform. inparticularly, the amtpaid$userid bit, is it just the number or does this mean amtpaiduser1 = 2080 (if that is the entered number). <tr> <td width=10> </td> <td><?= $userid ?></td> <td><?= $rentamt ?></td> <td><input size="10" maxlength="10" type="text" value="0" name="amtpaid<?= $userID ?>"></td> <td><input size="10" maxlength="10" type="text" value="4" name="currentperiod<?= $userID ?>"></td> </tr> the thing is, from the above example, there are 4 sets of data I want to add to the recordset. plus I need to calculate a $balance figure before i insert the data the $balance figure = houserentamt - amtpaid (so if someone hasn't paid anything there $balance = -(their own)rentamt. do i calculate this now, or in the form processing part. also my $query2 in the form processing part is: $query = "INSERT INTO rent_transaction ( id, userid, currentperiod, amtpaid, balance) VALUES ('null', '$userid', '$currentperiod', '$amtpaid', '$balance')"; so this is where i am stuck, as i am not sure how much data is being passed through from the form, or how to work out the $balance figure. so for instance, as my end result i need something like this being generated: INSERT INTO rent_transaction ( id, userid, currentperiod, amtpaid, balance) VALUES ('null', 'user1', '4', '2080', '1516'), ('null', 'user2', '4', '0', '-563'), ('null', 'user3', '4', '0', '-455'), ('null', 'user4', '4', '0', '-498') any ideas? |