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

  • Home
  • SEARCH
  • 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 6191687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:48:33+00:00 2026-05-24T02:48:33+00:00

I have a form with dynamically created input fields – upon submitting it I

  • 0

I have a form with dynamically created input fields – upon submitting it I would like to place all the generated data into an array using php.

An example of the html:-

<fieldset id="usp">
<input type="text" id="usp_1" name="usp_1" />
<input type="text" id="usp_2" name="usp_2" />
</fieldset>
<input type="hidden" id="uspTot" name="uspTot" />

input id=usp_1 and usp_2 were generated by Jquery on the fly – there can be any number of these inputs depending on the user so Jquery keeps a tally in the hidden field id=uspTot

When the form is posted I have tried to put the values of these input elements into a simple array using the following PHP code :-

$uspCount = $_POST["uspTot"];
for ($i=1; $i<=$uspCount; $i++)
 {
  $uspString[$i] = $_POST["usp_" + $i];
 };

It doesn’t work of course! But I can’t see why not?

Any pointers?

EDIT: this is the error code I receive:-

Notice: Undefined variable: POST in C:\Users\Andrew\Documents\Websites\example\html\submitbrief.php on line 21

EDIT 2:

This is the var_dump as requested by @Michael:-

array(36) { ["co_name"]=> string(11) "Daves autos" ["co_about"]=> string(16) "established 1969" ["co_id"]=> string(10) "Dave Smith" ["co_email"]=> string(21) "dave@davesautos.co.uk" ["co_phone"]=> string(11) "34435454545" ["usp_1"]=> string(9) "its great" ["usp_2"]=> string(9) "i love it" ["usp_3"]=> string(15) "its about car4s" ["uspTot"]=> string(1) "3" ["co_keyw_1"]=> string(0) "" ["co_keyw_2"]=> string(0) "" ["co_keyw_3"]=> string(0) "" ["co_keyw_4"]=> string(0) "" ["co_keyw_5"]=> string(0) "" ["co_compet"]=> string(0) "" ["ex_pos"]=> string(0) "" ["ex_neg"]=> string(0) "" ["ex_url"]=> string(0) "" ["pac_basic"]=> string(3) "yes" ["pac_cms"]=> string(2) "no" ["pac_eco"]=> string(2) "no" ["pac_ax"]=> string(4) "base" ["pac_ie6"]=> string(2) "no" ["pac_url"]=> string(0) "" ["pac_dom"]=> string(2) "no" ["pac_ins_1_url"]=> string(0) "" ["pac_ins_1_det"]=> string(0) "" ["pac_keyw_1"]=> string(0) "" ["pac_keyw_2"]=> string(0) "" ["pac_keyw_3"]=> string(0) "" ["pac_keyw_4"]=> string(0) "" ["pac_keyw_5"]=> string(0) "" ["pac_name"]=> string(0) "" ["pac_dem"]=> string(0) "" ["pac_gui"]=> string(0) "" ["pac_tex"]=> string(0) "" } 
  • 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-24T02:48:34+00:00Added an answer on May 24, 2026 at 2:48 am

    Try this in your for loop:

    $uspString[$i] = $_POST["usp_" . $i];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form with field names that are generated dynamically by server side
How to handle dynamically generated form submit in asp.net mvc? Form is dynamically created
Let's say I have some HTML and Javascript which adds text fields dynamically to
please help me with a simple PHP doubt. I have a simple form: <
I would like to know people's thoughts on the best way to do the
How can I dynamically create a form element and provide it with dynamically incremented
I have a data processing system that generates very large reports on the data
While developing for multiple sets of browsers, what issues have you faced while development
I'm trying to create a view that contains a list of checkboxes that is
This goes back to my other question which I thought was sufficiently answers but

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.