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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:54:07+00:00 2026-05-13T10:54:07+00:00

I have a form that is being generated on the fly in PHP using

  • 0

I have a form that is being generated on the fly in PHP using the below ($theFeatures is a multidimensional array):

<?php 
foreach($theFeatures as $theKey => $theValues) {
?>
    <input type="text" value="<?php echo $theValues['Key']; ?>" name="theFeatures[<?php echo $theKey; ?>]['Key']" size="6" />
    <input type="text" value="<?php echo $theValues['Value']; ?>" name="theFeatures[<?php echo $theKey; ?>]['Value']" /> <br />
<?php
}
?>

This should create two input boxes that look like this:

<input value="Type" name="theFeatures[4]['Key']" size="6" type="text" />
<input value="Bird Table" name="theFeatures[4]['Value']" type="text" />

How can I get the first part of the array ( [4] in the above example ) in jQuery so I can store that as a JavaScript variable and use it else where in my jQuery??

Cheers,

Andy

  • 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-13T10:54:07+00:00Added an answer on May 13, 2026 at 10:54 am

    You could try just storing the value in a separate attribute on the input and then retrieving that attribute with jQuery.

    Adding the new attribute to the input

    <input type="text" value="<?php echo $theValues['Key']; ?>" name="theFeatures[<?php echo $theKey; ?>]['Key']" size="6" key="<?php echo $theKey; ?>"/>
    

    Retrieving the attribute with jQuery

    var key = $("input").attr("key");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 536k
  • Answers 536k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer XPath is a query language and it cannot be used… May 17, 2026 at 1:24 am
  • Editorial Team
    Editorial Team added an answer A reduce function may be called once, with a key… May 17, 2026 at 1:24 am
  • Editorial Team
    Editorial Team added an answer strcmp returns 0 if both strings are same. assert takes… May 17, 2026 at 1:24 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have a simple form that has a list (dropdown list generated from a
I have three values that are being generated dynamically in the code-behind of my
I have a drop down list that is dynamically generated using a mySQL database
I have a form generator that uses (perl compatible) regexes for ther backend validation.
I have found an image format that is being used by some applets. but
I currently have a site with multiple articles being user-generated as content. On each
I have a simple C++ function that calls uuid_generate_random. It seems the generated UUID
I have a Model that has several properties. When I submit a form, I
I have been using .net for the past couple of years, and I like
I have a 2 part form. The 1st form is submitted via $.post and

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.