Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9047385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T11:53:47+00:00 2026-06-16T11:53:47+00:00

I have the following code which loops through an array to create forms that

  • 0

I have the following code which loops through an array to create forms that are filled with values (which the user will be able to edit) on a single page. There are as many forms as there are loops in the array, which is always changing.

<body>
<div id="main">
    <?php
    foreach($articles as $item) { ?>
        <div id='container'>
            <form>
                Title: <input type="text" name="title" size="80" value="<?php echo $item[0]; ?>">
                <br>
                URL: <input type="text" name="url" size="80" value="<?php echo $item[1]; ?>">
                <br>
                End Date: <input type="text" name="endDate" value="<?php echo substr($item[7], 14, strpos($item[7], '@') - strlen($item[7])); ?>">
                <br>
                <?php
                    if (substr($item[8], 0, 2) === 'Su'){
                    } else {
                ?>
                Start Date: <input type="text" name="startDate" value="<?php echo substr($item[8], 7, 9); ?>">
                <?php } ?>
            </form>
        </div>
    <?php } ?>
</div>
</body>

Now, I want the user to have a single submit button at the bottom of the page which will submit ALL the forms on the page to MySQL database. The problem is I don’t know how to do that.

I know the submit button takes the format of

<input type="submit" value="Submit">

I am assuming I need to give each form in the loop a unique name but from there I am at a loss as to what my next step should be to actually send and receive the information from these multiple forms.

Any help would be appreciated. Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T11:53:48+00:00Added an answer on June 16, 2026 at 11:53 am

    You can’t submit more than one form at once. What is wrong with putting all sets of <input>s into a single form?:

    <body>
    <div id="main">
        <form>
        <?php
        $inpCnt = 0;
        foreach($articles as $item) {
            $inpCnt++;  ?>
            <div id='container'>
                    Title: <input type="text" name="title_<?php echo $inpCnt; ?>" size="80" value="<?php echo $item[0]; ?>">
                    <br>
                    URL: <input type="text" name="url_<?php echo $inpCnt; ?>" size="80" value="<?php echo $item[1]; ?>">
                    <br>
                    End Date: <input type="text" name="endDate_<?php echo $inpCnt; ?>" value="<?php echo substr($item[7], 14, strpos($item[7], '@') - strlen($item[7])); ?>">
                    <br>
                    <?php
                        if (substr($item[8], 0, 2) === 'Su'){
                        } else {
                    ?>
                    Start Date: <input type="text" name="startDate_<?php echo $inpCnt; ?>" value="<?php echo substr($item[8], 7, 9); ?>">
                    <?php } ?>
            </div>
        <?php } ?>
    </form>
    </div>
    </body>
    

    You need to be able to define each of these inputs aswel. So I’ve used the loop to give each one a unique name.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code, which loops through an array of menuoptions and on
I have the following code which will generate two pdf files containing plots to
I have a for loop which loops through an array and want to match
I have the following script (below). which will return the status code of URLs.
I have some image processing code that loops through 2 multi-dimensional byte arrays (of
I have been using the following code for the last few months, which loops
I have following code which works for radio buttons but need to be changed
I want to know is below code correct ? I have following code which
I have the following code which definitely returns a proper data result if I
I have the following code which is working, I was wondering if this can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.