Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 396
  • Last Modified:

Insert multiple records into table from repeat region

Hi Experts

I am using dreamweaver and SQL 2005.  I have a web page that displays rows data that meets a certain criteria.  If there is more than one row of data that meets this criteria it is repeated via the repeat region behaviour.

Is there anyway i can insert all rows returned into a SQL table via a single submit?

Thanks in advance for any suggestions.

1 Solution
Mark GilbertSenior Performance EngineerCommented:
Hi, if you are able to loop through the post variables that are submitted as an array then you yes, you will be able to do multiple inserts using a single submit but multi form fields.  For example <input type="text" name="myfield[]"> and repeat this field as many rows as you have, when you submit then loop through the array  returned by myfield[] and do your insert
I answered a question a few day's ago that seems to relatet to what you're asking.  I used a variable to count how many rows were being displayed, and dynamically named the form fields so they incremented (i.e. value1, value2, value3).  The number of the last row was then stored in a hidden field.

On submission the highest value was read back from the hidden field, then we looped again to collect the values from each field and performed the insert.


Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now