Hello out there:
I am new to PHP and MySQL, so any and all help that anyone can offer me would be greatly appreciated. Here is my situation.
I have a database that I created that is used for storing names and descriptions of different products that I plan on selling. When I go to different events to sell these products, I wanted to create a form that I can fill out that will let me know how many of each product that I’ve brought, how many I’ve sold, and the standard price that each item was sold for at that particular event. It sounded basic to me when I started the idea, but here is the problem that I am running into and my lack of knowledge of this stuff is keeping me cornered and stuck. I have a button on my site that I click onto and by doing so, it is supposed to check the database that I created, find out how many products are in the Products table at that time, and then display that number of <input type=“text”> boxes (one for each product in the database). So basically, if there are 10 products, I need the first part of the coding to display each product name, a text box for each product so I can enter the number of products brought to sell, a text box for each product so I can enter the number of each product that was sold, and a text box for each product so I can enter the standard price that the products were sold for at that particular event.
As far as the above situation, I was able to find a way to do that but here is my snag. In order to accomplish the above situation, I just ran a SELECT statement to select everything in the Products table and ran the mysql_fetch_array to have each prodcut be printed out with the different text boxes. But the problem I’m running into, is that once I input the information into the text boxes, how do I get PHP to read that information and INPUT it into a different table that I’ve created. The problem I’m having is that in order for PHP to recognize the value that is entered into each text box, each text box has to have an individual name. But I can’t seem to find a way to give each text box a different name and write the coding to get it to input. I’m stuck.
If anyone out there has any ideas on how to do this, or even if I’m approaching this idea in the wrong manner, please let me know. I would appreciate any help, like I said, I’m very new and am afraid that I was trying to bite off more than I could chew on my own…so that’s why I’m seeking help from the experts.