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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T22:47:58+00:00 2026-05-28T22:47:58+00:00

I am trying to receive a post array send from the view page by

  • 0

I am trying to receive a post array send from the view page by using $this->input->post(). However, it seems like that CI is not able to do it. Any thoughts?

controller

public function pub()
    {
    // the postArray is an array: $postArray['t1']=test1, $postArray['t2']=test2 
    $go=$this->input->post('postArray');    
    foreach ($go as $test){

    echo $test['t1'];  //show nothing
    echo $test['t2'];  //show nothing

    }

//the following code would work if I sent the $postArray as a string variable

 public function pub()
    {
    // the postArray is an string variable $postArray='test1'
    $go=$this->input->post('postArray');    

    echo $go; //show test1

        }

Thanks for help.

UPDATE:
the following is the Jquery code in my view page

   //postArray is an array
     $.post('<?=base_url()?>/project_detail/pub', {'postArray':postArray},function(go)
        {
            alert(go);
        })
  • 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-28T22:47:58+00:00Added an answer on May 28, 2026 at 10:47 pm

    Have you checked your HTML? You should include the [] synthesis into the name attribute to create an array, for example

    <input type="text" value="something..." name="postArray[]" />
    <input type="text" value="something..." name="postArray[]" />
    

    Output of print_r($this->input->post()):

    Array (
    
       [0] => something...
       [1] => something...
    )
    

    If you want to include name keys instead of indexed array, you can use this method:

    <input type="text" value="something..." name="postArray[t1]" />
    <input type="text" value="something..." name="postArray[t2]" />
    

    Output of print_r($this->input->post()):

    Array (
    
       [t1] => something...
       [t2] => something...
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to send and receive using pipes: send.cpp struct { long a; long
I'm trying perform a relatively basic TCP socket send/receive operation on Windows CE using
I'm trying so send push notifications ton my iPhone (APNS). I read this post
I am trying to send data, in json format to my webservice, using POST.
I'm trying to send a POST request from iPhone to Django, but for some
I am trying to use a value that I receive from a MySQL query
I am trying to receive a json object back from php after sending data
I am trying to receive an image from the Android Gallery via an ACTION_SEND
I seem to be getting this particular always when i am trying to receive
When trying to declare a static array in my program I receive a static

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.