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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T23:51:13+00:00 2026-06-12T23:51:13+00:00

I have a form on my page. On submit I need to get the

  • 0

I have a form on my page. On “submit” I need to get the post data from the form and store it in a multidimensional array.

This is what I have so far.

//view
<input type="text" name="option[fname]" />
<input type="text" name="option[lname]" />
<input type="submit" />

//controller
$data['myarray'] = $this->input->post('options', TRUE);
$this->load->view('template',$data);

Then on “submit” we go back to the view and see what we have added.

//view
<?php
foreach($myarray as $row){
    echo $myarray['fname'] . '<br>' . $myarray['lname'];
}
?>

I want to be able to keep adding to the array each time I hit “submit”. Right now it is only displaying the last entered data. How do I do that? Thanks?

  • 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-12T23:51:15+00:00Added an answer on June 12, 2026 at 11:51 pm

    You must save your array in a file, a cookie or a database at each request.

    Simplified example with saving to file:

    // controller
    // load array from the file if exists
    if (is_file('myarray.dat')) $myarray = unserialize(file_get_contents('myarray.dat'));
    // put new data to array
    $myarray[] = $this->input->post('options', TRUE);
    // output array
    $this->load->view('template', array('myarray' => $myarray));
    // save array back to the file
    file_put_contents('myarray.dat', serialize($myarray));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a timed page that I need to use to submit a form
i have a submit page in html . when i submit the form data,
I have a url (http://www2.anac.gov.br/aeronaves/cons_rab.asp) where I need to post form data programatically. That
Possible Duplicate: jQuery AJAX submit form I have a form on a page A,
I have a html form that posts to a new page on submit. If
I have a simple form on a page and I want to auto submit
I have a form on a non-SSL page that I want to submit as
I have a form in an HTM page that, after pressing the submit button,
After I submit a form I have 2 $_POST variables. In the landing page
I have a page Results with a form and when submit is clicked, the

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.