Hi, im having problems with accessing form data in my controller. i have an 
if statement that checks if $this->request->data is not empty before going 
further but it is showing up as empty. im not sure why it is doing this so 
i have add my model, view and controller files.
Thanks in advance


(Controller) UsersController.php:

 public function send_invitation() {
      $user = $this->Auth->user();
      //echo "<pre>"; print_r($user); die;
      $this->layout = "dashboard";
      if (!empty($this->request->data)) {
           $this->Reference->set($this->request->data);
           $this->Reference->setValidation('add');

           ...               

      } else { echo 'no data';}

      $this->set("user", $user);
 }



(Model) Reference.php: 

class Reference extends AppModel {

     public $useTable = 'references'; 
     public $name = 'Reference';

     public $belongsTo = array('User' => array(
                                    'className' => 'User',
                                    'foreignKey' => 'user_id'
                            ),


     );

     var $actsAs = array('Multivalidatable'); 
     public $validationSets = array(
        'add' => array(
            'email' => array(
                'notEmpty' => array(
                    'rule'     => 'notEmpty',
                    'required' => true,
                    'message'  => 'Please enter email.'
                ),
                'valid' => array(
                    'rule'  => 'email',
                    'required' => true,
                    'message'  => 'Please enter valid email.'
                ),
            ),
            'name' => array(
                'notEmpty' => array(
                    'rule'     => 'notEmpty',
                    'required' => true,
                    'message'  => 'Please enter name.'
                )
            ),

        ),
    );
 }





(View) send_invitation.ctp: 

<div class="dashboard-container-right">
      <div class="dashboard-innerright">
            <div class="upper-dashboard"><h1> <?php echo __("Send 
Invitations"); ?> </h1></div> 
            <div class="botm-forcolor">
                <div class="midd-dashord">
                    <?php echo __("Your Referral Code is"); ?> <strong><?php 
echo $user["referral_code"];?> </strong> 
                    <div class="invite-content">
                     <!--- Instructor Login -->
                  <div class="tab-pane active" id="instructor">
                       <?php echo $this->Form->create('Reference' , 
array('id'=>'send_invites' , 'url' => array('controller' => 'users', 'action' 
=> 'send_invitation' ) , 'novalidate'=>'novalidate')); ?>     
                <?php  $form=$this->Form;?>
                    <div class="padding_15tabs">
                        <div class="col-md-12  show-grid row">
                <?php $name=__("Name"); ?>  
                <?php echo 
$form->input('Reference.name',array('class'=>'col-xs-12 col-sm-12 col-lg-12 
text-style', 'placeholder'=>$name, 'div' => false,'label'=>false))?>            
             


                            </div>
                        <div class="col-md-12  show-grid row">
                <?php $email=__("Email"); ?>    
                <?php echo 
$form->input('Reference.email',array('class'=>'col-xs-12 col-sm-12 col-lg-12 
text-style', 'placeholder'=>$email, 'div' => false,'label'=>false))?>           
                
                            </div>
                            <div class="col-md-12  show-grid row">
                <?php $message=__("Message"); ?>    
                <?php echo 
$form->textarea('Reference.message',array('class'=>'col-xs-12 col-sm-12 
col-lg-12 text-style', 'placeholder'=>$message, 'div' => 
false,'label'=>false))?>                            


                            </div>
                        <input type="hidden" name="data[Reference][user_id]" 
value="<?php echo $user['id']; ?>">                    
                        <div class="col-md-12  show-grid row">
                            <div class="align-center">
                                <span class="span_float">
                                    <input type="submit" value="<?php echo 
__('Invite'); ?>" class="create-account btn btn-primary"  /><br/>

                                </span>
                            </div>
                        </div>

                    </div>  
                    </form>
                  </div>



              </div>

         </div>
     </div>
</div>


-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at https://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

Reply via email to