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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:46:40+00:00 2026-05-24T09:46:40+00:00

I am building an application with codeigniter that involves adding a carer with multiple

  • 0

I am building an application with codeigniter that involves adding a “carer” with multiple telephone numbers to a database. From the UI side of things, there is an add button next to each telephone field that uses some javascript magic to clone itself in order for the user to input another number. When the form is submitted, the telephone numbers are submitted as an array.

I have two models setup: carer and carer_telephone. Each model has it’s own respective table.

I have been racking my brains for a way that I can get datamapper to validate all the relations before saving them. For example at the moment, only the validation errors for the carer fields are displayed, none for the carer_telephone fields.

Also, I’m not sure if this is the most memory efficient way of dealing with this i.e. creating a new carer_telephone object for every number.

This must be a common setup for many applications but I can’t seem to find any documentation on the subject. I am looking for the most standard way of doing this with regards to DataMapper.

The controller so far

function add() {

    //Create carer object
    $c = new carer();

    //Create carer telephone object
    $t = new carer_telephone();

    //Form submitted
    if($this->input->post('add_carer')) {

        //Set carer data
        $c->title           = $this->input->post('title');
        $c->first_name      = $this->input->post('first_name');
        $c->family_name = $this->input->post('family_name');
        $c->display_name    = $this->input->post('display_name');
        $c->date_of_birth   = $this->input->post('date_of_birth');
        $c->email_address   = $this->input->post('email_address');
        $c->street_address  = $this->input->post('street_address');
        $c->town            = $this->input->post('town');
        $c->county          = $this->input->post('county');
        $c->postcode        = $this->input->post('postcode');

        //Set and save telephones
        foreach($this->input->post('telephone') as $tel) {
            $t = new carer_telephone();
            $t->type    = 'test';
            $t->number  = $tel;
            $c->save($t);
        }

    }

    //Store carer object
    $this->_data['content']['carer'] = $c;

    //Load view
    $this->load->view('carers/add',$this->_data);

}

Any help on this would be greatly appreciated. Even just a link to an example where somebody has worked on this situation.

Best regards,
Dan

  • 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-24T09:46:40+00:00Added an answer on May 24, 2026 at 9:46 am

    There is an array extension that comes with DataMapper which might be of use to you: http://datamapper.wanwizard.eu/pages/extensions/array.html – lets you save array data to a database, etc.

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

Sidebar

Related Questions

I am building application that required some data from iPhone's Call log(read only). The
Building an application with a database that has the ability to get big not
I'm building an application in Python2.6 that needs to get data from CouchDb. I'm
Building an application, before using a real database, just to get things work I
I'm building a codeigniter application that will serve custom microsites. Essentially each microsite will
Im building my first application using CodeIgniter, i need a bit of advice. There
I am building a PHP application in CodeIgniter. CodeIgniter sends all requests to the
When building an application, is there any meaningful difference between the idea of Find
I'm building an application that is targeting Windows, Mac and Linux soon. I was
We're currently building an application that executes a number of external tools. We often

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.