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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:48:30+00:00 2026-05-23T11:48:30+00:00

I have one form where user can dynamically add new text box. With each

  • 0

I have one form where user can dynamically add new text box. With each textbox, I have one checkbox (for option to show or hide in frontend). It’s like below.

<ul>
     <li><input type="text" name="field_name[]" /></li>   
     <li><input type="checkbox" name="show_hide[]" /></li>
</ul>

<input type="button" value="Add More Field">

When I get the post value from PHP, I am confused how can i related the checkbox with its corresponding textbox since array of checkbox ‘show_hide[]’ may depends upon the user input.

  • 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-23T11:48:31+00:00Added an answer on May 23, 2026 at 11:48 am

    You could use an index:

    <ul>
         <li><input type="text" name="field_name[0]" /></li>   
         <li><input type="checkbox" name="field_name[0]" /></li>
    </ul>
    

    And then your jQuery, every time you add a new text box and checkbox set their name to show_hide[index] etc. You could store the index globally and just update it when a new text box is added, or use regex to parse the previous input to get the last index and increment it that way. Then on the server you’ll get an array you can check. The other way to do it would be something like:

    <ul>
         <li><input type="text" name="field_name[0][text]" /></li>   
         <li><input type="checkbox" name="field_name[0][checked]" /></li>
    </ul>
    

    Which will give you a bit of a nicer array to work with 🙂

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

Sidebar

Related Questions

I have several forms(user can add new form dynamically) in one page, they're all
I have a new batch form where user can select books from a div
I have a ext.form.Combobox object that is dynamically populated by ext.data.JsonStore. The user can
I have WPF Application where I have One main form and other user controls
I have one form with several text fields and one button. When i enter
i have one form which have some input box and some select box. i
Using web forms I know that you can only have one ASP.NET form on
I have a form that can be dynamically duplicated (with JS) so that the
Running on Rails 3.1 RC1 and following this . A user can have one
I have a form where user can change his personal information that is already

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.