Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/144201-solved-save-auto-generated-rows/
Share on other sites

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. :)

 

 

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?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.