How can I save form input to a database, I'm having trouble sending the values to my controller.
- by Sergio Tapia
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?