title: Get value from textfield and pass as parameter to MySQL Stored Procedure in yii
body: <p>I'm new with programming in Yii..I have a textfield in views/_form and i want to get the entered value in textbox to be sent as parameter to a MySQL stored procedure.</p>
  
  <pre><code>&lt;div class="form"&gt;
  &lt;?php $form=$this-&gt;beginWidget('CActiveForm', array(
  'id'=&gt;'usercredentials-form',
  // Please note: When you enable ajax validation, make sure the corresponding
  // controller action is handling ajax validation correctly.
  // There is a call to performAjaxValidation() commented in generated controller code.
  // See class documentation of CActiveForm for details on this.
  'enableAjaxValidation'=&gt;false,
  )); ?&gt;
  
  &lt;p class="note"&gt;Fields with &lt;span class="required"&gt;*&lt;/span&gt; are required.&lt;/p&gt;
  
  &lt;?php echo $form-&gt;errorSummary($model); ?&gt;
  
  &lt;div class="row"&gt;
      &lt;?php echo $form-&gt;labelEx($model,'userCredentialsEmail'); ?&gt;
      &lt;?php echo $form-&gt;textField($model,'userCredentialsEmail',array('size'=&gt;60,'maxlength'=&gt;128)); ?&gt;
      &lt;?php echo $form-&gt;error($model,'userCredentialsEmail'); ?&gt;
  &lt;/div&gt;
  
  &lt;?php $this-&gt;endWidget(); ?&gt;
  
  &lt;/div&gt;&lt;!-- form --&gt;
  </code></pre>
  
  <p>I want to get Email entered by user to be sent as parameter to the MySQL stored procedure insert_usercred.Please Help..</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>This is my Usercredntialscontroller.php/actionCreate()</p>
  
  <pre><code>public function actionCreate()
  {
  
      $model=new Usercredentials;
      $userid=Userportfolio::model()-&gt;findByPk($model-&gt;iduserCredentials);
  
  
      // Uncomment the following line if AJAX validation is needed
      // $this-&gt;performAjaxValidation($model);
  
  
  
      if(isset($_POST['Usercredentials'])
      {
          $model-&gt;attributes=$_POST['Usercredentials'];
  
  
           echo $userCredentialsEmail = $_POST["Usercredentials"]["userCredentialsEmail"];
  
  
          if($model-&gt;save())
              $this-&gt;redirect(array('view','id'=&gt;$model-&gt;iduserCredentials));
      }
  
      $this-&gt;render('create',array(
          'model'=&gt;$model,
          ));
  }
  </code></pre>
  
  <p><strong>EDIT</strong></p>
  
  <p>This is what i've done to execute the stored procedure</p>
  
  <pre><code>if(isset($_POST['Usercredentials'))
      {
          $model-&gt;attributes=$_POST['Usercredentials'];
          echo $userCredentialsEmail = $_POST["Usercredentials"]["userCredentialsEmail"];
          $command = Yii::app()-&gt;db-&gt;createCommand('call executeInsert($userCredentialsEmail)');
          if($command-&gt;execute())
              $this-&gt;redirect(array('view','id'=&gt;$model-&gt;iduserCredentials));
      }
  
      $this-&gt;render('create',array(
          'model'=&gt;$model,
          '
      ));
  }
  </code></pre>