Hi everyone, I am new to php and I was trying hard to alter an existing script ut I didn't succeed to...
I have 2 databases:
- Categories (catid, shortname, description)
- Transactions (date, amount, balance, user)
in the categories I have 9 categories.
the script displays the categories as checkboxes to choose from. I want to add the following functionality:
If I select for example 3 categories, I would like to know how can I count the selected checkboxes and based on the count update the transactions database:
in another way:
if count=3 => add amount x 3 to the transactions database so if a user select 4 categories I update the transaction database with $5 x 4 categories and then we will get a balance of $20 for the choosen categories.
I have tried to use:
$checked = count($_POST['category']);
but with this one, if I already have 2 selected then choose another two then the database will update 4 cats rather then the new added 2.
thanks in advance