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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:34:39+00:00 2026-05-24T19:34:39+00:00

hi i am using codeigniter . i have a form , there i add

  • 0

hi i am using codeigniter . i have a form , there i add hidden fields dynamically . so every hidden field is <input type='hidden' name='hidden' value="+$(this).attr('title')+"> so the name is equal .

the problem is when i submit the form and try to get my hiden field values i can only get one hidden field value , because the names are same

i print my form values

print_r($this->input->post());

i have 2 hidden fields but i get only one

Array
(
    [hidden] => march
    [textbox] => march
    [mysubmit] => Submit
)

i can change the name dynamically of hidden field when creating , but then i don’t know exactly the name of my hidden field ,

how can i get hidden field values with same name ?? is there any way to get form values other than by name ?? i tried and can not find an answer , please help ………….

  • 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-24T19:34:40+00:00Added an answer on May 24, 2026 at 7:34 pm

    You’ll need to use brackets in your name attributes:

    <input type='hidden' name='hidden[]'>
    <!--                            ^^^^                                   -->
    

    This will allow PHP to accept multiple inputs with the same name as an array of values, so in this case, $_POST['hidden'] will return an array of strings.

    By default they are indexed starting at 0, so $_POST['hidden'][0] will get you the first one, $_POST['hidden'][1] will get you the second, etc., however – you can explicitly index them if it’s easier for you, either with numbers or strings.

    <input type='hidden' name='hidden[first]'>
    <input type='hidden' name='hidden[second]'>
    

    Or:

    <input type='hidden' name='hidden[0]'>
    <input type='hidden' name='hidden[1]'>
    

    You can nest these as deep as you want like hidden[first][1][], and they will be treated similarly to a PHP array when you get the $_POST values, but you need the brackets in the HTML.

    Without brackets, only the last field’s value will be available in the $_POST array. This is a PHP feature, Codeigniter can’t do anything about it.

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

Sidebar

Related Questions

I have a form which uploads multiple file fields into a db using codeigniter.
I have this form that validates the fields on submit through ajax (using Codeigniter's
I am developing site using codeigniter.I have a form which contains add button and
I have a search form: <form id=global_search> <input id=global_search_input name=search_query placeholder=Enter search text> <input
I have a PHP project (I'm using CodeIgniter) with data capture. The form is
Is there a method to prepopulate a certain field in a form using data
Using ASP.NET MVC there are situations (such as form submission) that may require a
I have been coding in php and using codeigniter as well, never got the
In my LAMP application (using CodeIgniter), I have a call to $this->db->update... that generates
A few questions today :) I am using Codeigniter. I have a header view,

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.