I am trying to get the data from this form into the relevant controller using Ajax, but it displays the Error message Undefined Index, Player
<?php
$form=$this->beginWidget('CActiveForm', array(
'id'=>'player-form',
'enableAjaxValidation'=>false,
));
?>
<div class="row">
<?php echo CHtml::activeLabelEx($model,'item'); ?>
<?php echo $form->textField($model,'item') ?>
</div>
<div class="row">
<?php echo CHtml::activeLabelEx($model,'currentQty'); ?>
<?php echo $form->textField($model,'currentQty') ?>
</div>
<div class="row">
<?php echo CHtml::activeLabelEx($model,'requiredQty'); ?>
<?php echo $form->textField($model,'requiredQty') ?>
</div>
<div class="row">
<?php echo CHtml::activeLabelEx($model,'notes'); ?>
<?php echo $form->textField($model,'notes') ?>
</div>
<div class="row">
<?php echo CHtml::ajaxButton("Insert Item", array('player/ajaxcreate','type'=>'POST'),array('success'=>'allFine')); ?>
</div>
Filename of the above form is list.php
public function actionAjaxCreate() {
$p = new Player();
$p->attributes=$_POST[‘Player’];
if($p->save()){
echo "OK"; // echo or not, if an exception dont occur then is OK.
}else{
throw new Exception("Sorry, cant create a player",500);
}
Any ideas on what is wrong here