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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T06:17:57+00:00 2026-06-16T06:17:57+00:00

I have one form which has two text fields. One is Price and another

  • 0

I have one form which has two text fields. One is Price and another one is share.These text fields are repeating for every row. I am extracting the values after submit in a post array. But the POST array coming in a normal way. I want it in a specific way like below.

<td colspan="3"><label><?php echo form_error('amount'); ?></label><input type="text" class="textsmall" name="post_cost[]" id="<?php echo $cust_id_cur; ?>" value="<?php echo set_value('amount'); ?>" /></td>

<td colspan="3"><label><?php echo form_error('share'); ?></label><input type="text" class="textsmall" name="post_share[]" id="<?php echo $cust_id_cur; ?>" value="100" /></td>

These are the two text fields. When i submit the POST array is like this……..

post_cost                             
(                                      
[0] => 324123
[1] => 324123
[2] => 324123
[3] => 324123
[4] => 324123
[5] => 324123
)

post_share
(
[0] => 100
[1] => 100
[2] => 100
[3] => 100
[4] => 100
[5] => 100
)

But i want two of the above arrays like this. There is filed called $cust_id_cur that is unique filed. I want values of each array against those id’s. What i mean is there six rows totally so there will be six cust_id's.

post_cost
(
[$cust_id_cur] => 324123
[$cust_id_cur] => 324123
[$cust_id_cur] => 324123
[$cust_id_cur] => 324123
[$cust_id_cur] => 324123
[$cust_id_cur] => 324123
)

why i am asking like this is my order of cust_id's are not always same. So i will give against cust_id. When i submit i need to save them in the database against that cust_id. So i want array like the above.

  • 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-16T06:17:58+00:00Added an answer on June 16, 2026 at 6:17 am

    You can populate the index with your variable in the loop:

    <td colspan="3"><label><?php echo form_error('amount'); ?></label><input type="text" class="textsmall" name="post_cost[<?php echo $cust_id_cur; ?>]" id="<?php echo $cust_id_cur; ?>" value="<?php echo set_value('amount'); ?>" /></td>
                                                                                                                           ^^^^^^^^ here
    
    <td colspan="3"><label><?php echo form_error('share'); ?></label><input type="text" class="textsmall" name="post_share[<?php echo $cust_id_cur; ?>]" id="<?php echo $cust_id_cur; ?>" value="100" /></td>
                                                                                                                           ^^^^^^^^ here
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two forms. One of which has two fields, the name field, and
I have written a simple CRUD form which has one select list. However the
I have a web form that has 2 radio buttons, depending on which one
I have one form with several text fields and one button. When i enter
I have a form which has a input text and a set of radio
I have a database that has two tables, one of which contains a foreign
I have an asp.net view which has two partial views. One for edit information
I have a form that has two buttons. One for saving a record and
llo, I have a form that has two submit buttons: one accept and one
I have a form which has multiple input fields, and 3 main options. depending

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.