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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:15:24+00:00 2026-06-08T05:15:24+00:00

I have a page that allows the user to add and remove text fields

  • 0

I have a page that allows the user to add and remove text fields to a form using JavaScript.

Text fields are named field1, field2, field3, etc. and depends on how many fields the user has added

I’m trying to store all the values from my text fields into one Php variable;

I understand that i need to store them into an array first and then use implode(), but how can i specify how many inputs there are within my Php code?

  • 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-08T05:15:25+00:00Added an answer on June 8, 2026 at 5:15 am

    Usually the best way to approach this is to use array-named input, as shown in the following example in the PHP docs:

    <form action="" method="post">
        Nombre:  <input type="text" name="personal[nombre]" /><br />
        Email:   <input type="text" name="personal[email]" /><br />
        Cerveza: <br />
        <select multiple name="cerveza[]">
            <option value="warthog">Warthog</option>
            <option value="guinness">Guinness</option>
            <option value="stuttgarter">Stuttgarter Schwabenbräu</option>
        </select><br />
        <input type="submit" value="submit me!" />
    </form>
    

    You could use the very same name for each of the user added fields, as in:

    <input type="text" id="field1" name="fields[]" />
    <input type="text" id="field2" name="fields[]" />
    

    And then just use implode as required:

    $imploded_fields = implode(', ', $_POST['fields']);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form that allows a user to add an unlimited number of
I'm using ASP.Net/C# and I have a form that allows people to add information
I have a page that allows for used input, when the user inputs his/her
I have an ASP.NET (3.5) page that allows a user to upload an Excel
I have an online store. A products page that allows the user to view
I have a page that has fields dynamically loaded via JQuery. It allows a
I have a view function that allows a user to Add / Edit /
I currently have a page that allows a user to enter different types of
I have a web page that uses three controls to allow a user to
I have a html page that allows users to submit a file. Below is

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.