Add an else to the if (save) command: 
die(debug($this->Student->validationErrors));  Maybe it's failing at the db 
level.

Jeremy Burns
Class Outfit

http://www.classoutfit.com

On 28 Jun 2011, at 12:20, varai wrote:

> Hi
> 
> my following students_controller.php is not saving the student info in
> the form. I have no idea on what is the prob. I have already checked
> the data to be saved using var_dump($this->data)
> 
> students_controller.php
> <?php
> class StudentsController extends AppController{
> 
> function add(){
> if (!empty($this->data)){
>       var_dump($this->data);
>       if ($this->Student->save($this->data)){
>               $this->Session->setFlash('Your child\'s admission has been
> received. We will send you an email shortly.');
>       $this->redirect(array('action'=>'home'));
>                               }
>               }
>       }
> }
> ?>
> 
> add.ctp
> <?php
>       echo $form->create('Student', array('action'=>'add'));
>       echo '<fieldset>';
>       echo '<legend>Student Information</legend>';
>       echo $form->input('Student.name');
>       echo $form-
>> input('Student.gender',array('type'=>'radio','options'=>array('Male'=>'Male','Female'=>'Female'),'value'=>'Male'));
>       echo $form->input('Student.dob',
> array('label'=>'DOB','dateFormat'=>'DMY'));
>       echo $form->input('Student.class_id', array('label'=>'Enquiry Class
> for',
>       'options'=>array('1'=>'Playgroup','2'=>'Nursery','3'=>'LKG',
> '4'=>'UKG'),'selected'=>'1'));
>       echo '</fieldset>';
> 
>               echo $form->end('Submit');
> 
> 
> ?>
> 
> -- 
> Our newest site for the community: CakePHP Video Tutorials 
> http://tv.cakephp.org 
> Check out the new CakePHP Questions site http://ask.cakephp.org and help 
> others with their CakePHP related questions.
> 
> 
> To unsubscribe from this group, send email to
> [email protected] For more options, visit this group at 
> http://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to