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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:14:30+00:00 2026-06-11T07:14:30+00:00

Have a query that should hopefully be nice and simple to answer. I have

  • 0

Have a query that should hopefully be nice and simple to answer.

I have a form that will be used to add rows into a database. The default number of rows to show when loading the page is 6. I would like to add the option to add more rows to the form, by changing a field, or clicking a button etc.

I currently use a while loop to print out the form. I simply say:

while($rows > 0) {
    echo "FORM INPUTS HERE";
    $rows = $rows - 1;
}

So the loop goes through a prints a set of inputs for record 1, and then takes one off the count, then prints a set of inputs for record 2, and so on.

Is there a way I can get the while loop to print more without refreshing the page? The simplest way would be to have a small form at the top of the page, with an extra columns field, and submit button. This would then post the value back to the same page, and add it to the default number of rows.

I would like to do this without having to submit, post or GET anything, but to have it happen then and there.

I think it may be tricky, as the while loop will have already run, and I dont know how to get it to run a second time.

Cheers

Eds

  • 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-11T07:14:31+00:00Added an answer on June 11, 2026 at 7:14 am

    You can use ajax to make your wish. It doesn’t refresh page, but sends out a request to the server asynchronously and fetches the content and appends to the form.

    Example, if you have a code this way:

    <form method="post">
        <ul>
            <li><label><strong>Field 1:</strong> <input type="text" /></label></li>
            <li><label><strong>Field 2:</strong> <input type="text" /></label></li>
            <li><label><strong>Field 3:</strong> <input type="text" /></label></li>
            <li><label><strong>Field 4:</strong> <input type="text" /></label></li>
            <li><label><strong>Field 5:</strong> <input type="text" /></label></li>
        </ul>
    </form>
    

    Now using jQuery‘s $.getScript function, you can fetch a script, which is similar to this:

    $("form ul").append('<li><label><strong>Field ' + $currentValue + ':</strong> <input type="text" /></label></li>');
    

    This works out for you.

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

Sidebar

Related Questions

We have a simple LINQ-to-Entities query that should return a specific number of elements
I have a doubt regarding database operation.I have one insert query that should run
I have a query that I know it should atleast return one row. How
I have a query that returns me around 6 million rows, which is too
I have a query that should always be returning a single int. I have
I have this query that i should make it run on SQL Azure. WITH
I have a query that I don't think should be that hard to make,
i have a query that should return 40 results: $test = mysql_query( SELECT fname
So I have a query that should get all posts from a table while
I have an update query that should update a field with the most frequent

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.