How can I save form input to a database, I'm having trouble sending the values to my controller.

Posted by Sergio Tapia on Stack Overflow See other posts from Stack Overflow or by Sergio Tapia
Published on 2010-03-04T22:15:48Z Indexed on 2010/03/08 9:21 UTC
Read the original article Hit count: 489

Filed under:
|
|
|
|

Here's my RegisterController:

public function saveforminformationAction(){
        $request = $this->getRequest();

        if($request->isPost()){
            //I NEED HELP WITH THE getFormValues() METHOD.
            $formResults = $this->getFormValues();
            $db = $this->_getParam('db');

            $data = array(
            'user'      => $formResults['username'],
            'email'     => $formResults['email'],
            'password'  => $formResults['password'],
            'passwordc' => $formResults['passwordc'],
            'name'      => $formResults['name'],
            'avatar'    => $formResults['avatar'],
            );


            $db->insert('Usuario',$data);           
        }
    }

And here's my registration view:

<body>  
        <h1>Thanks for signing up!</h1> 
        <?php
        $this->form->setAction($this->url(array('controller' => 'registration','action'=>'saveforminformation'))); 
        $this->form->setMethod('post');
        echo $this->form;
        ?>


        <img alt="signupimg" src="/img/signup.png">
    </body>

I'm fairly new to Zend, but I'm eager to learn.

How can I get the values sent in the form?

© Stack Overflow or respective owner

Related posts about zend-framework

Related posts about php