Advertisement
Guest User

session - cakephp issue - php

a guest
Mar 1st, 2013
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.65 KB | None | 0 0
  1. public function ajax_index(){
  2.        
  3.         $this->autoRender = false;
  4.        
  5.         if ($this->request->is('ajax')){
  6.            
  7.             Sanitize::clean($this -> request -> data['Participant']);
  8.            
  9.             $clean_data = array();
  10.             $clean_data['vote'] = $this->Session->read('id');
  11.            
  12.            
  13.             $this -> Participant -> set($clean_data);
  14.  
  15.             if ($this -> Participant -> save($clean_data)) {
  16.                
  17.                 return true;
  18.             }
  19.             else{
  20.            
  21.                 $errors = "";
  22.                 foreach($this->Participant->validationErrors as $key => $val){
  23.                     foreach ($val as $index => $error_msg){
  24.                         $errors  .= $error_msg . "<br />";
  25.                     }
  26.                 }
  27.                
  28.            
  29.                 return $errors;
  30.                
  31.             }
  32.            
  33.         }
  34.        
  35.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement