Ok, let me lay out an example and see if this fits you.
I have my table, listing all the inventory I'm holding for a customer, including counts of each item. My customer wants to release inventory, so how do I let him do this?
One design option is to build the form into the display table, as an extra column. I'd put my <form> tags outside my <table> tags and my table might have the following 4 columns:
Item Number
Item Description
Amount in Storage
Amount to be Released
"Amount to be Released" is a form <input> tag that allows the customer to specify how much he wants to release. You could use a "text" type to do this, but to reduce error checking, I'd use PHP to query the MySQL database, find how much the user has, then create a dropdown box ranging from zero to the amount the customer has in storage. After the table is finished, have a submit button taking you to the processing script.
What variables to pass? I'd say the item number as the variable name and the amount to release as the value. Then, I'd of course pass the customer identifier, so we know whose account to debit. I'd probably pass a return variable, like I discussed earlier, so I can move pages around or change page names with little modification.
The receiving script retrieves the passed parameters via $POST[''] or $GET[''], depending on the method you chose to pass information in in your form. It assigns variables to these passed parameters at the same time. Example: $Customer_ID=$_POST['cust_id'];
Next, you connect to your MySQL database, and retrieve the inventory and quantities the customer owns. Use a while() loop to process each returned value. In the while() loop, do the following:
- Extract the row
- If the $Inventory_ID isn't nul, then...
- Subtract from the current Inventory quantity the amount that was posted from the form.
- Update the MySQL table with the new amount
After looping through all the customer's inventory, then use your http-refresh to return back to the original form. All values should then be updated.
Does this help?