maxat Posted February 7, 2009 Share Posted February 7, 2009 Hi everybody, I have a problem with function I want to store orders of each company in the database. But each company has different number of items in the order list. There is a HTML table with user defined number of rows and with text fields inside based on number of inquiries. After rows are generated name of each text field remaining the same. How can I add each text field data into my MySql database? Because there might be 1 row or 100 rows. Do you have any idea how to solve this problem? Thanks in Advance Quote Link to comment https://forums.phpfreaks.com/topic/144201-solved-save-auto-generated-rows/ Share on other sites More sharing options...
anthylon Posted February 8, 2009 Share Posted February 8, 2009 Hello, I am not sure if I understand you well but let me try. :-\ First, you need to name fields on forms properly to accept multiple variables - array. For example: <input name="article_id[]" /> After POST is made, you need to get variable from $_POST. It will be actually array of all fields. Then you need to enumerate it - that would be all. I hope this could be helpful for you. Quote Link to comment https://forums.phpfreaks.com/topic/144201-solved-save-auto-generated-rows/#findComment-757242 Share on other sites More sharing options...
maxat Posted February 9, 2009 Author Share Posted February 9, 2009 Thanks for reply. OK I understood, I had that in mind, but there is a problem. Lets say user wanted to have 7 rows and inside we will have 7 text fields starting with "name1" till "name7". It will be generated automatically. Problem is how to make SQL statement that will send all of them to database one by one? Quote Link to comment https://forums.phpfreaks.com/topic/144201-solved-save-auto-generated-rows/#findComment-757930 Share on other sites More sharing options...
anthylon Posted February 9, 2009 Share Posted February 9, 2009 Hello, I think this link will help you: http://www.phpfreaks.com/forums/index.php/topic,237430.0/topicseen.html. It is the same issue but there you can find exact code. Quote Link to comment https://forums.phpfreaks.com/topic/144201-solved-save-auto-generated-rows/#findComment-758046 Share on other sites More sharing options...
maxat Posted February 10, 2009 Author Share Posted February 10, 2009 Thanks a lot Quote Link to comment https://forums.phpfreaks.com/topic/144201-solved-save-auto-generated-rows/#findComment-758702 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.