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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:33:16+00:00 2026-05-27T14:33:16+00:00

I am following nettut+ tutorial for pagination and to store POST inputs as querystrings

  • 0

I am following nettut+ tutorial for pagination and to store POST inputs as querystrings in db. So far, everything works fine until, suppose if I get an array as POST input, I am unable to loop through it and get all the array values and to store into query_array (i.e., store array within array).

The snippets below:

$query_array = array(
'gender' => $this->input->post('gender'),
'minage' => $this->input->post('minage'),
'maxage' => $this->input->post('maxage'),
'Citizenship' => $this->input->post('citizenship'), // checkboxes with name citizenship[]
);

This returns only last stored array value in Citizenship.

The output array:

Array ( [gender] => 1 [minage] => 18 [maxage] => 24 [Citizenship] => 2 ) 

makes the query string as:

&gender=1&minage=18&maxage=24&Citizenship=2

But, my requirement is to get all the values of ‘Citizenship’ array instead of last stored value.

The output required to make query string:

Array ( [gender] => 1 [minage] => 18 [maxage] => 24 [Citizenship] => 2 [Citizenship] => 4 [Citizenship] => 6 ) 

The query string :

&gender=1&minage=18&maxage=24&Citizenship[]=2&Citizenship[]=4&Citizenship[]=6
  • 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-27T14:33:17+00:00Added an answer on May 27, 2026 at 2:33 pm

    Doesn’t look like code ignighter supports un-named multidimensional arrays as input without a bit of hacking.

    If you can access raw $_POST data try replacing

    $this->input->post('citizenship')
    

    with

    array_map('intval',$_POST['citizenship'])
    

    Alternativly add keys to your post data:

    &gender=1&minage=18&maxage=24&Citizenship[0]=2&Citizenship[1]=4&Citizenship[2]=6
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

// following code works fine n open notepad... class demo { public static void
Following on from an earlier question I'm trying to get multiple (widgets or in
I am following a tutorial from nettuts, specifically here: http://blog.themeforest.net/tutorials/jquery-for-absolute-beginners-day-11/ I am 3/4's of
Following the docs in the bundle, I get this exception: InvalidConfigurationException: Unrecognized options fos_facebook
Following code is used to get images from particular folder but how to get
following extjs3 problem: i have an json store: dbStore = new Ext.data.JsonStore({ url: '/?[action]=getFormData',
Following this writeup ... The compiled binary seems to work fine, but the installed
I was following a dropdown menu tutorial: http://net.tutsplus.com/tutorials/html-css-techniques/how-to-create-a-drop-down-nav-menu-with-html5-css3-and-jquery/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed:%20nettuts%20(NETTUTS)&utm_content=Netvibes What I really want to do
Following my earlier post I am now trying now to bind the visibility of
I'm following a simplified version of the scraping tutorial by NetTuts here, which basically

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.