Hey guys, been using cake for about 5 days now.

So I have two tables. users and user_infos, using advice in another
thread I have created a model for each. I have also made sure to 'var
$uses = array('UserInfo');' in my UsersController.

My app has a form in a view. I shall paste the form here.

views/users/add_user.ctp
<?php
        echo $form->create(null, array('url' => '/users/addUser'));
        echo $form->input('info_email');
        echo $form->input('password');
        echo $form->input('password_confirm', array('type' => 'password',
'label' => 'Password Confirmation'));
        echo $form->input('info_firstname');
        echo $form->input('info_lastname');
        echo $form->end('save');
?>

As you can see the form's action leads to UserController::addUser();

I shall paste it here also.

/app/controllers/user_controller.php

function addUser() {
                Configure::write('debug', 2);

               //debug($this->data);
                //check for data

                if ($this->data) {
                //check for correct passworsd
                if ($this->data['UserInfo']['password'] == $this->Auth-
>password($this->data['UserInfo']['password_confirm'])) {

                        $this->User->create();
                        $this->UserInfo->addUserInfo($this->data);
                        //if saving to database is successful, move the users 
to the
login screen.
                        if($this->UserInfo->save($this->data)){
                                        $this->flash('Your User has been 
Created.', 'login');
                                }
                }
        }
}

As you can see I have attempted to go off to
UserInfosController::addUserInfo($this->data) which is simply

function addUserInfos($data){
        $this->UserInfos->save($this->data);
}

I will also be as kind as to add the debug($this->data)

Array
(
    [UserInfo] => Array
        (
            [info_email] => user1234
            [password] => pass1234
            [password_confirm] => pass1234
            [info_firstname] => Adrian
            [info_lastname] => Love
            [info_phone] => 0733334444
            [info_mobile] => 0433334444
            [info_address] => candy mountain
            [info_postcode] => 4444
            [info_state] => QLD
            [info_dob] => Array
                (
                    [month] => 12
                    [day] => 21
                    [year] => 1986
                )

        )
)

Now, Dispite me having Configure::debug set to 2. there isn't much
output on what is happening, I click save on my form and it stays at
the form without going anywhere, the tables remain empty. as you can
see I've tried looking around for ideas on this situation but have
become alittle stuck.

Thanks for your time,  I hope my issue was well explained.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

  • Two tables, one form. Adrian Love (aijokaiz...@gmail.com)

Reply via email to