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 651421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:09:35+00:00 2026-05-13T22:09:35+00:00

I am trying to save data into the same table several times from the

  • 0

I am trying to save data into the same table several times from the same $_POST array. You see, on my registration form a family is allowed to specify the names, gender and age of all members they wish to bring along.

This data is being stored in a database table called aditional_member. Based on family size, I am dynamically generating html table rows where each row has the number of input fields required.

<tr id="additionalmember_3">
    <td><input type="text" name="first_name1" maxlength="50" value="" /></td>
    <td><input type="text" name="last_name1" maxlength="50" value="" /></td>
    td><select name="gender1" value="" ><option value='Male'>Male</option><option value='Female'>Female</option></select></td>
    <td><select name="age_group"value="" ><option value='18 to 30'>18 to 30</option><option value='31 to 60'>31 to 60</option></select></td>      
</tr>

When I POST, let us say I have three sets of input(3 table rows as above), Is there a simple way to insert into the addional_member table the data from row one, then row two, and so on. I tried looping the insert statement, which failed. I am basically open to suggestions, I do not need to use a table.

Any ideas,
Thank you.

  • 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-05-13T22:09:36+00:00Added an answer on May 13, 2026 at 10:09 pm

    I don’t know if I understood correctly what you want, but try this

        <?php
        //having 3 rows to insert 
        for($i=1;$i<4;$i++){
    
            mysql_query("INSERT INTO Table (field1, field2, field3) values (
              '".$_POST['first_name'.$i]."',
              '".$_POST['last_name'.$i]."',
              '".$_POST['gender'.$i]."')");
        }
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to save some data into an array but unfortunately all the data
I'm trying to save the returned data from HTTP request into a variable. The
I'm trying to create core data application. Some times when trying to save data,
I am trying to save my data from a view that was loaded on
I'm trying to save some lookup table data out to a YAML file so
I am trying to make a backup for my data from my first table
I am trying to save the data from a loop of logical tests. So
I am new to ASP.net MVC. I am trying to save the data into
I am trying to save data in JSON and load it back into the
I'm trying to write a very big data chunk (resulting from JSON.stringify) into a

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.