title: CakePHP: Display form post value in ctp file from controller
body: <p>I'm currently working on a CakePHP web application I have already created <code>form</code> in <code>view.ctp</code> and <code>form submitted</code> through ajax, but when I try to display form value in <code>add.ctp</code> from controller which is not showing.</p>
  
  <p>When I print or echo variable in controller value is showing, how can I get value and display in <code>add.ctp</code> file?</p>
  
  <p>I want ajax post form data from <code>view.ctp</code> to controller file and i want to see form data in <code>add.ctp</code> file from controller? CakePHP version is 2.0.13</p>
  
  <p><strong>View.ctp</strong></p>
  
  <pre><code>&lt;?php echo $form-&gt;create('Review',array('action'=&gt;'add/'.$listingData['Listing']['id'].'','id'=&gt;'saveForm')); 
  
  echo $form-&gt;input("starrating",array(
                      'title'=&gt;__("Eek! Methinks not"),
                      'type'=&gt;'radio',
                      'options'=&gt;array('1' =&gt; '1'),
                      'class'=&gt;'hover-star',
                      'value'=&gt;'testing',
  
  )
  );  
  
  echo $form-&gt;input("starrating",array(
                      'title'=&gt;__("Meh. I've experienced better"),
                      'type'=&gt;'radio',
                      'options'=&gt;array('2' =&gt; '2'),
                      'class'=&gt;'hover-star',
                      'value'=&gt; '2',
  
  )
  );
  
  echo $form-&gt;input("starrating",array(
                      'title'=&gt;__("A-OK"),
                      'type'=&gt;'radio',
                      'options'=&gt;array('3' =&gt; '3'),
                      'class'=&gt;'hover-star',
                      'value'=&gt; '3',
  
  )
  );  
  
  echo $form-&gt;input("starrating",array(
                      'title'=&gt;__("Yay! I'm a fan"),
                      'type'=&gt;'radio',
                      'options'=&gt;array('4' =&gt; '4'),
                      'class'=&gt;'hover-star',
                      'value'=&gt; '4',
  
  )
  );
  
  echo $form-&gt;input("starrating",array(
                      'title'=&gt;__("Woohoo! As good as it gets!"),
                      'type'=&gt;'radio',
                      'options'=&gt;array('5' =&gt; '5'),
                      'class'=&gt;'hover-star',
                      'value'=&gt; '5',
  
  )
  );      
  
  
  echo $form-&gt;end(); ?&gt;
  </code></pre>
  
  <p><strong>Add Ctp</strong></p>
  
  <pre><code>&lt;?php echo $this-&gt;pageStarRating;?&gt;
  </code></pre>
  
  <p>**Ajax &amp; Javascript **</p>
  
  <pre><code>$(document).ready(function () {
          $('.hover-star').rating({
  
          focus: function (value, link) {
                  $("#hover-test").css("color", "#000");
                  var tip = $('#hover-test');
                  tip[0].data = tip[0].data || tip.html();
                  tip.html(link.title || 'value: ' + value);
  
          },
          blur: function (value, link) {
                  var tip = $('#hover-test');
                  $('#hover-test').html(tip[0].data || '');
  
          },
  
          click: function (value, link) {
                  var tip = $('#hover-test');
                  tip.empty();
  
  
          },
  
          callback: function(value, link){
                  var tip = $('#stick');
                  tip.html(link.title || 'value: ' + value);
  
              }
  
          });
  
          $(".hover-star").click(function () {
              $("#hover-test").css("color", "#ff6a00");
              $('#saveForm').submit();
  
          });
  
          $(document).ready(function() {
                  $('#saveForm').submit(function() {
                      var formData = $(this).serialize();
                      var formUrl = $(this).attr('action');
  
                        $.ajax({
                          type: 'POST',
                          url: formUrl,
                          data: formData,
                          success: function(data, textStatus, xhr) {
                              //alert(data);
                              window.location = formUrl;
  
                              },
                          error: function(xhr, textStatus, error) {
                              alert(textStatus);
                          }
                      });
                      return false;
                  });
              });
  </code></pre>
  
  <p><strong>Controller File</strong></p>
  
  <pre><code>if($this-&gt;Review-&gt;save($this-&gt;data))
  
  {   
      echo $add=$this-&gt;data['Review']['starrating']; 
  
  }
  
  $this-&gt;pageStarRating = $add;
  </code></pre>