Insert multiple records into table from repeat region

Posted on 2007-10-18
Last Modified: 2008-01-09
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.

Question by:grantballantyne
    LVL 18

    Expert Comment

    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
    LVL 20

    Expert Comment

    LVL 25

    Accepted Solution

    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.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Suggested Solutions

    Title # Comments Views Activity
    Need to restrict access to my site 4 46
    Best IDE for PHP starters 10 63
    Need Graphic Design work done 2 34
    Effect on button 11 40
    Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
    Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
    The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now