I am rewriting a program I made some time ago to help me manage my video rental store. Currently I am having trouble gathering variables during the "rental" process.
The main page of the program allows me to control multiple operations. To rent a video I have a form with 2 options and a button. The options are a field for the number of videos and a pulldown for selecting the renters account.
After I process that form, I have a "for" statement create an HTML table for each video, going down the page. Each table is the same, having a field to enter that video's ID number, and a few options for things like free rentals. Each table's options/fields are named vid#id, vid#free and so on. The # goes from 1 to the total number of videos as the tables are created.
The part I am stuck at is being able to cycle thru those different #'s variables in order to gather each video's information and total up the price for the final confirmation page. I would use another "for" statement to get vid1_id and then access a database for the rest of the info, then vid2_id and so on. I am just unsure on how to get the "for" statement to go from vid1_id to vid2_id.
I am thinking there is a better way to go about this, like using an array. Something I have always been confused on is creating variable arrays from a group of identically named GET or POSTs. I know it can be done with multiple selection lists, but would I just have to rename each vid#_id field to be the same name and access them via vid_id[#]?
Could anyone shed some light on this situation?