im struggling with my cake code(very new to cakephp) and was after some help. what is intended by my code is to get data from a form and when the person hits register it send data to my database but that is not happening, instead when i hit register the page is reloading. I’m currently using cake 2.0 and wamp server 2.2
here is the code for my add function from my individualscontroller.php
function addIndividual(){
if($this->request->is('individuals')){
{if ($this->Individual->save($this->request->data)) {
$this->Session->setFlash('The user has been saved');
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash('The user could not be saved. Please, try again.');
}
}
}
} code here
and here is the code from my add_individual.ctp including the form
<h2>Please enter your details</h2>
<?php
echo $this->Form->create('individuals', array('action'=>'addIndividual'));
echo $this->Form->input('Title: ');
echo $this->Form->input('First Name: ');
echo $this->Form->input('Surname: ');
echo $this->Form->input('Street Address: ');
echo $this->Form->input('Suburb: ');
echo $this->Form->input('State: ');
echo $this->Form->input('Country: ');
echo $this->Form->input('Email: ');
echo $this->Form->input('Password: ');
echo $this->Form->end('Click here to Register');
?>
EDIT – The name of the table im trying to insert data into is called individuals
any help would be greatly appreciated
Change this code to
Also please change your view file as follows.
Change the model like this